aboutsummaryrefslogtreecommitdiff
path: root/slackware-upgrade-system
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-09-18 20:54:55 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2019-09-19 17:01:22 +0200
commitbaba41efcec9f510b8a6444438a6f37cf8736f85 (patch)
tree025f0f1a75dcd9f2464083ba426274d0145c3258 /slackware-upgrade-system
parent80088a438e46a1556123722275531499a40b06b2 (diff)
downloadslackupgrade-baba41efcec9f510b8a6444438a6f37cf8736f85.tar.gz
slackupgrade-baba41efcec9f510b8a6444438a6f37cf8736f85.tar.bz2
Bugfixes
* Add version-specific packages to installation candidates. Currently only upgrade between 14.1 and 14.2 receives special handling: the removed packages procps, udev and portmap are replaced by the corresponding packages in 14.2 * Abort immediately if any of essential packages cannot be downloaded.
Diffstat (limited to 'slackware-upgrade-system')
-rw-r--r--slackware-upgrade-system70
1 files changed, 54 insertions, 16 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system
index eb655a6..400212d 100644
--- a/slackware-upgrade-system
+++ b/slackware-upgrade-system
@@ -112,14 +112,14 @@ function getyn() {
fi
}
-function error {
+function error() {
echo >&2 "$0: $*"
if [ -n "$logfile" ]; then
echo >$logfile "$0: $*"
fi
}
-function abend {
+function abend() {
error "$@"
tempdir_remove
exit 1
@@ -381,6 +381,7 @@ tail +13 $checksums | \
# Initialize log file name
logstem=/var/log/slackware-upgrade-system-$VERSION-$newversion
logfile=$logstem.log
+remove_report=$logstem.removed
# Check if pkgdir exists and contains the necessary files and directories
for series in $series_names
@@ -413,31 +414,64 @@ do
done
if [ -n "$install_packages" ]; then
echo $install_packages
-fi) | sort -u > candidates
+fi) | sort -u > candidates.$$
# Build a list of packages that should be removed after install
-remove_list=$logstem.removed
-comm -2 -3 $installed_list candidates > $remove_list.$$
+comm -2 -3 $installed_list candidates.$$ > remove.list.$$
if [ -s "$keep_file" ]; then
grep -v '^#' $keep_file | \
- tr -s '\n' | sort | comm -2 -3 $remove_list.$$ - > $remove_list
- rm $remove_list.$$
+ tr -s '\n' | sort | comm -2 -3 remove.list.$$ - > remove.list
+ rm remove.list.$$
else
- mv $remove_list.$$ $remove_list
+ mv remove.list.$$ remove.list
fi
+# Scan the remove.list for names of the packages that are replaced with
+# another packages in the new release. If found, add the names of the
+# replacements to the list of installation candidates and remove original
+# names from the $remove_report.
+#
+# Reads package replacement map from the standard input. Each input line
+# contains old and new package names, separated by whitespace.
+function replace_pkglist() {
+ # Update candidates and save the replacement map in a temporary.
+ sort +0 -1 | \
+ tee rename.$$ | \
+ join -a2 -o 1.2,2.1 - candidates.$$ | \
+ awk '{print $1}' | \
+ sort -u > candidates
+ # Use the temporary to remove the original package names from the report.
+ awk '{print $1}' rename.$$ | \
+ comm -13 - remove.list > $remove_report
+ # Clean up
+ rm rename.$$
+}
+
+# Create $remove_report and the list of installation candidates.
+case $VERSION-$newversion in
+ 14.1-14.2)
+ replace_pkglist <<EOF
+procps procps-ng
+udev eudev
+portmap rpcbind
+EOF
+ ;;
+ *) cp remove.list $remove_report
+ mv candidates.$$ candidates
+esac
+
# Disable interrupts during critical section
trap '' HUP INT QUIT ABRT
-if [ -s $remove_list -a "$verbosity" != 'q' ]; then
+if [ -s $remove_report -a "$verbosity" != 'q' ]; then
(cat <<EOF
INFO: The following packages will be removed. You will have to manually
restore them after the upgrade. The package names are preserved for you
-in the file $remove_list:
+in the file $remove_report:
EOF
-cat $remove_list) | ${PAGER:-more}
+cat $remove_report) | ${PAGER:-more}
fi
if ! version_gt $newversion $VERSION; then
@@ -467,7 +501,11 @@ pkg_files=
echo "$0: Downloading essential packages"
for pkg in $pkg_names
do
- pkg_files="$pkg_files${pkg_files:+ }"$(getfile $(package_file_name $pkg))
+ file=$(getfile $(package_file_name $pkg))
+ if [ -z "$file" ]; then
+ abend "failed to download $pkg"
+ fi
+ pkg_files="$pkg_files${pkg_files:+ }$file"
done
echo "$0: Installing essential packages"
@@ -495,16 +533,16 @@ do
upgrade_package $pkg --install-new
done
-if [ -s $remove_list ]; then
+if [ -s remove.list ]; then
echo "$0: removing packages"
if [ -n "$dry_run" ]; then
:
elif [ "$verbosity" = 'v' ]; then
- removepkg $(cat $remove_list) | tee -a $logfile | grep '^Removing package'
+ removepkg $(cat remove.list) | tee -a $logfile | grep '^Removing package'
else
- removepkg $(cat $remove_list) >> $logfile
+ removepkg $(cat remove.list) >> $logfile
fi
- echo "$0: see $remove_list for the list of packages that have been removed"
+ echo "$0: see $remove_report for the list of packages that have been removed"
fi
echo "$0: upgrade finished; see $logfile for details"

Return to:

Send suggestions and report system problems to the System administrator.