Changeset - 5b58d757f956
[Not reviewed]
default
0 1 0
Dennis Fink - 7 years ago 2013-03-08 08:03:37
the_metalgamer@hackerspace.lu
added traps
1 file changed with 11 insertions and 0 deletions:
yaah
11
0 comments (0 inline, 0 general)
yaah
Show inline comments
...
 
@@ -277,6 +277,9 @@ extract_and_remove () {
 

	
 
            tar xzf $1 -C $downloaddir
 

	
 
            msg_verbose2 "Setting trap to remove archive and extracted directory"
 
            trap "rm -rf $1 $downloaddir/${1%.tar.gz}" EXIT
 

	
 
            msg_verbose1 "Removing '$1'"
 
            rm $1
 
        else
...
 
@@ -308,6 +311,9 @@ download () {
 
            curl -s -fL -o "$downloaddir/$filename" \
 
                "${AURURL}packages/$start/$1/$filename"
 

	
 
            msg_verbose2 "Setting trap to remove downloaded file"
 
            trap "rm -f $downloaddir/$filename" EXIT
 

	
 
            if [[ $? -eq 0 ]]; then
 
                extract_and_remove "$downloaddir/$filename"
 
            else
...
 
@@ -352,6 +358,10 @@ verbose=0
 
quiet=0
 
downloaddir="$PWD"
 

	
 
if [[ $# -eq 0 ]]; then
 
    usage
 
    exit 1
 
fi
 

	
 
while true; do
 
    case $1 in
...
 
@@ -389,6 +399,7 @@ while true; do
 
            ;;
 
        -*)
 
            error "Unknown option: $1"
 
            usage
 
            exit 1
 
            ;;
 
        *)
0 comments (0 inline, 0 general)