aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-09-15 23:12:18 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2019-09-15 23:12:18 +0200
commit66cb557a9ab03de4eff810547136c39b78b2b781 (patch)
treeec9afe9f6d77b19529ca879c3dce269ff7d980ed
parent95399e244e492b044a680dac87569d18c6564de5 (diff)
downloadslackupgrade-66cb557a9ab03de4eff810547136c39b78b2b781.tar.gz
slackupgrade-66cb557a9ab03de4eff810547136c39b78b2b781.tar.bz2
Implement version checking.
New option -p. Fix -q option.
-rw-r--r--slackware-upgrade-system25
-rw-r--r--slackware-upgrade-system.84
2 files changed, 26 insertions, 3 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system
index 4b66255..5979758 100644
--- a/slackware-upgrade-system
+++ b/slackware-upgrade-system
@@ -33,6 +33,8 @@ install_all=
# Names of the series that should be installed in addition to already installed
# packages. Ignored, if install_all is set.
install_series=
+# Names of additional packages.
+install_packages=
# Name of the keep-list file.
keep_file=
@@ -80,6 +82,7 @@ Options are:
-h display this help list and exit
-k FILE preserve packages listed in FILE
-n dry-run mode: do nothing, print what would have been done
+ -p PACKAGE install additional package
-q quiet mode: suppress all messages, except errors
-s SERIES additionally install all packages from SERIES;
incompatible with -a
@@ -240,7 +243,11 @@ function upgrade_package() {
fi
}
-while getopts "ahknq:s:vy" OPTION
+function version_gt() {
+ test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"
+}
+
+while getopts "ahknp:qs:vy" OPTION
do
case $OPTION in
a) install_all=y;;
@@ -248,6 +255,7 @@ do
exit 0;;
k) keep_file=$OPTARG;;
n) dry_run=y;;
+ p) install_packages="$install_packages $OPTARG";;
q) verbosity=q;;
v) verbosity=v;;
s) install_series="$install_series $OPTARG";;
@@ -307,7 +315,7 @@ if [ -z "$rooturl" ]; then
rooturl="$mirrors_url/slackware$ARCH-$new_version"
error "info: using $rooturl as distribution top-level URL"
else
- error "no URL supplied"
+ abend "can't find distribution newer than $VERSION; please supply URL if you have any"
fi
fi
@@ -395,7 +403,10 @@ fi
for s in $install_series
do
series_package_names $s
-done) | sort -u > candidates
+done
+if [ -n "$install_packages" ]; then
+ echo $install_packages
+fi) | sort -u > candidates
# Build a list of packages that should be removed after install
remove_list=$logstem.removed
@@ -422,6 +433,14 @@ EOF
cat $remove_list) | ${PAGER:-more}
fi
+if ! version_gt $newversion $VERSION; then
+ if ! getyn n "Distribution version $newversion is same or lower than current version $VERSION. Downgrade"; then
+ tempdir_remove
+ echo Exiting
+ exit 0
+ fi
+fi
+
if ! getyn n "Ready for upgrade from $VERSION to $newversion. Continue"; then
tempdir_remove
echo "Exiting"
diff --git a/slackware-upgrade-system.8 b/slackware-upgrade-system.8
index dbf35e4..08b5056 100644
--- a/slackware-upgrade-system.8
+++ b/slackware-upgrade-system.8
@@ -23,6 +23,7 @@ slackware\-upgrade\-system \- do a full upgrade of a Slackware installation
\fBslackware\-upgrade\-system\fR\
[\fB\-anqvy\fR]\
[\fB\-k \fIFILE\fR]\
+ [\fB\-p \fIPACKAGE\fR\]
[\fB\-s \fISERIES\fR]\
[\fIURL\fR]
.ad
@@ -134,6 +135,9 @@ as argument to that option. This way all packages will be preserved.
Dry-run mode: do nothing, print what would have been done. In spite
of the name, the list of packages for removal will still be created.
.TP
+\fB\-p \fIPACKAGE\fR
+Install additional package.
+.TP
.B \-q
Quiet mode: suppress all messages, except error diagnostics.
.TP

Return to:

Send suggestions and report system problems to the System administrator.