aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-09-12 14:06:48 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2019-09-12 14:06:48 +0200
commitf9bc962437f90c0a59071d5188558f309a9cce0e (patch)
tree5b5f2422aa92a567e86c5f4e13b608c42151294f
parent48d00ee156651256bd338f4d8f3aff73f75a2249 (diff)
downloadslackupgrade-f9bc962437f90c0a59071d5188558f309a9cce0e.tar.gz
slackupgrade-f9bc962437f90c0a59071d5188558f309a9cce0e.tar.bz2
Implement sanity check.
The /root/slackware directory must contain the distribution root, not the directory with package series
-rw-r--r--slackware-upgrade-system38
1 files changed, 34 insertions, 4 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system
index acc8288..0ff2444 100644
--- a/slackware-upgrade-system
+++ b/slackware-upgrade-system
@@ -2,8 +2,9 @@
set -e
-PKGDIR=/root/slackware
-logfile=/var/log/slackware-upgrade-system.log
+ROOTDIR=/root/slackware
+PKGDIR=$ROOTDIR/slackware64
+logfile=
dry_run=
assume_y=
quiet_mode=
@@ -55,6 +56,34 @@ do
esac
done
+# Sanity check
+if [ ! -s /etc/os-release ]; then
+ echo >&2 "$0: /etc/os-release doesn't exist"
+ exit 1
+fi
+
+. /etc/os-release
+
+if [ "$ID" != "slackware" ]; then
+ echo >&2 "$0: this doesn't seem to be a Slackware installation"
+ exit 1
+fi
+
+# Check if ROOTDIR exists and contains the necessary files and directories
+if [ ! -d $ROOTDIR ]; then
+ echo >&2 "$0: $ROOTDIR does not exist"
+ exit 1
+fi
+
+newversion=$(ls $ROOTDIR/ANNOUNCE.* |\
+ sed -e 's|.*/||' -e 's/ANNOUNCE\.//' -e 's/_/./g')
+if [ -z "$newversion" ]; then
+ echo >&2 "$0: cannot determine new version"
+ exit 1
+fi
+
+logfile=/var/log/slackware-upgrade-system-$VERSION-$newversion.log
+
# Check if PKGDIR exists and contains the necessary files and directories
if [ ! -d $PKGDIR ]; then
echo >&2 "$0: $PKGDIR does not exist"
@@ -145,7 +174,7 @@ EOF
cat $remove_list) | ${PAGER:-more}
fi
-if ! getyn n "Ready for upgrade. Continue"; then
+if ! getyn n "Ready for upgrade from $VERSION to $newversion. Continue"; then
echo "Exiting"
exit 0
fi
@@ -153,15 +182,16 @@ fi
cd $PKGDIR
# Upgrade the glibc shared libraries.
+echo "$0: Upgrading shared libraries"
upgrade_package a/glibc-solibs-*.t?z
# Upgrade the package utilities and related tools.
+echo "$0: Upgrading package utilities"
upgrade_package a/pkgtools-*.tgz
upgrade_package a/tar-*.tgz
upgrade_package a/xz-*.tgz
upgrade_package a/findutils-*.txz
-echo "$candidates">/tmp/c
if [ -n "$candidates" ]; then
for name in $candidates
do

Return to:

Send suggestions and report system problems to the System administrator.