summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2020-02-07 15:56:19 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2020-02-07 15:56:19 (GMT)
commit0a5f8ec4230566295e3f5b82e6083fd5b9bb2dea (patch) (side-by-side diff)
tree19e903e41fa42ef60464608b5314331792dc8c47
parentbed14b11e3d3070b92bb66203ae42d9e31393299 (diff)
downloadslackupgrade-0a5f8ec4230566295e3f5b82e6083fd5b9bb2dea.tar.gz
slackupgrade-0a5f8ec4230566295e3f5b82e6083fd5b9bb2dea.tar.bz2
Make sure all downloaded files are removed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--slackupgrade26
1 files changed, 21 insertions, 5 deletions
diff --git a/slackupgrade b/slackupgrade
index ada387b..30bfa9c 100644
--- a/slackupgrade
+++ b/slackupgrade
@@ -83,2 +83,7 @@ y
+onexit_remove_list=
+function onexit_remove() {
+ onexit_remove_list="$onexit_remove_list${onexit_remove_list:+ }$1"
+}
+
function tempdir_create() {
@@ -91,3 +96,3 @@ function tempdir_create() {
function tempdir_remove() {
- rm -rf $tempdir
+ rm -rf $tempdir $onexit_remove_list
}
@@ -255,7 +260,14 @@ function getfile() {
fi)
- if [ -n "$ascname" ] \
- && ${GPG:-gpg} --verify $ascname $name 2>/dev/null; then
- :
+ if [ -n "$ascname" ]; then
+ if ! err=$(${GPG:-gpg} --verify $ascname $name 2>&1 >/dev/null)
+ then
+ error "$err"
+ error "gpg verification failed for $name"
+ dropfile $ascname
+ return
+ else
+ dropfile $ascname
+ fi
else
- error "gpg verification failed for $name"
+ error "$name: no clearsign signature file found"
return
@@ -514,2 +526,3 @@ if [ -z "$checksums" ]; then
fi
+onexit_remove $checksums
@@ -525,2 +538,3 @@ if [ -z "$file" ]; then
fi
+onexit_remove $file
@@ -653,2 +667,3 @@ if [ $opmode != INCR ]; then
fi
+ onexit_remove $packages
download_size=$(sed -n -r \
@@ -746,2 +761,3 @@ do
fi
+ onexit_remove $file
pkg_files="$pkg_files${pkg_files:+ }$file"

Return to:

Send suggestions and report system problems to the System administrator.