aboutsummaryrefslogtreecommitdiff
path: root/slackupgrade
diff options
context:
space:
mode:
Diffstat (limited to 'slackupgrade')
-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
@@ -78,21 +78,26 @@ tcl
x
xap
xfce
y
"
+onexit_remove_list=
+function onexit_remove() {
+ onexit_remove_list="$onexit_remove_list${onexit_remove_list:+ }$1"
+}
+
function tempdir_create() {
u=$(umask)
umask 077
mkdir $tempdir
umask $u
}
function tempdir_remove() {
- rm -rf $tempdir
+ rm -rf $tempdir $onexit_remove_list
}
function usage() {
cat <<EOF
usage: $0 [-anqvy] [-k FILE] [-s SERIES] [DIRECTORY]
Upgrade Slackware installation
@@ -250,17 +255,24 @@ function getfile() {
if [ -n "$2" ]; then
ascname=$(if [ -n "$remote" ]; then
download $1.asc
else
catfile $1.asc
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
fi
fi
if [ -n "$checksums" ] && ! check_package_md5sum $1 $name; then
error "ERROR: $1: checksum failed"
@@ -509,23 +521,25 @@ info "verifying distribution"
# Download CHECKSUMS.md5. So far it is the only file that is gpg-checked.
# For the rest we rely on MD5 sums.
checksums=$(getfile CHECKSUMS.md5 gpg)
if [ -z "$checksums" ]; then
abend "CHECKSUMS.md5 not found in $rooturl"
fi
+onexit_remove $checksums
announce=$(tail +13 $checksums | \
sed -n -r\
-e 's/^[0-9a-fA-F]+[[:space:]]+(\.\/ANNOUNCE\.[[:digit:]_]+)$/\1/p')
if [ -z "$announce" ]; then
abend "ANNOUNCE not found in $rooturl"
fi
file=$(getfile $announce)
if [ -z "$file" ]; then
abend "file $announce not found in $rooturl"
fi
+onexit_remove $file
newversion=$(echo "$announce" | sed -e 's/\.\/ANNOUNCE\.//' -e 's/_/./g')
if [ -z "$newversion" ]; then
abend "cannot determine new version"
fi
@@ -648,12 +662,13 @@ if [ $opmode != INCR ]; then
# hosting SLACKUPGRADE_PKGDIR. Select safe mode if there is enough space,
# otherwise ask if the user wishes to continue in incremental mode.
packages=$(download PACKAGES.TXT)
if [ -z "$packages" ]; then
abend "PACKAGES.TXT not found in $rooturl"
fi
+ onexit_remove $packages
download_size=$(sed -n -r \
-e '/PACKAGE NAME:[[:space:]]*/{' \
-e 's///' \
-e 's/^(.*)-[^-]+-(i386|x86(_64)?|arm|noarch|fw)-[[:digit:]]+(_.*)?\.t.z$/\1 &/' \
-e h \
-e '}' \
@@ -741,12 +756,13 @@ info "downloading essential packages"
for pkg in $pkg_names
do
file=$(getfile $(package_file_name $pkg))
if [ -z "$file" ]; then
abend "failed to download $pkg"
fi
+ onexit_remove $file
pkg_files="$pkg_files${pkg_files:+ }$file"
done
info "installing essential packages"
upgrade_local $pkg_files

Return to:

Send suggestions and report system problems to the System administrator.