aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-09-12 15:40:14 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2019-09-12 15:40:14 +0200
commit85a7a7d77d7d7c91b69da9b8bd6dd700c7aca042 (patch)
tree26b7fe50e2baa67db59c094ae966d940fa4cbfe7
parent8fc1149868d39ca2e3fb67d1d00ee0b7b4be7acf (diff)
downloadslackupgrade-85a7a7d77d7d7c91b69da9b8bd6dd700c7aca042.tar.gz
slackupgrade-85a7a7d77d7d7c91b69da9b8bd6dd700c7aca042.tar.bz2
Implement the "keep-list"
Keep-list is a file with the names of packages that should be exempt from removal. Each line contains exactly one package name, without version and architecture information. Empty lines and comments (#) are ignored.
-rw-r--r--slackware-upgrade-system19
1 files changed, 15 insertions, 4 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system
index dde22f0..3407fb3 100644
--- a/slackware-upgrade-system
+++ b/slackware-upgrade-system
@@ -10,10 +10,11 @@ assume_y=
quiet_mode=
install_all=
install_series=
+keep_file=
function usage() {
cat <<EOF
-usage: $0 [-anqy] [-d DIRECTORY] [-s SERIES]
+usage: $0 [-anqy] [-d DIRECTORY] [-k FILE] [-s SERIES]
Upgrade Slackware installation
Options are:
@@ -22,6 +23,7 @@ Options are:
-d DIRECTORY look for slackware distribution in DIRECTORY;
default is $ROOTDIR
-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
-q quiet mode: suppress messages about individual packages
-s SERIES additionally install all packages from SERIES;
@@ -62,16 +64,17 @@ function upgrade_package() {
fi
}
-while getopts "ad:hns:qy" OPTION
+while getopts "ad:hnqk:s:y" OPTION
do
case $OPTION in
a) install_all=y;;
d) PKGDIR=$OPTARG;;
h) usage
exit 0;;
+ k) keep_file=$OPTARG;;
n) dry_run=y;;
- s) install_series="$install_series $OPTARG";;
q) quiet_mode=y;;
+ s) install_series="$install_series $OPTARG";;
y) assume_y=y;;
*) usage >&2
exit 1
@@ -192,7 +195,15 @@ find $PKGDIR \
-e 's/-[^-]+-(i386|x86(_64)?|arm|noarch|fw)-[[:digit:]]+((_.*)?\.t.z)?//' | \
sort > $avail_list
-comm -2 -3 $installed_list $avail_list > $remove_list
+comm -2 -3 $installed_list $avail_list > $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.$$
+else
+ mv $remove_list.$$ $remove_list
+fi
+
if [ -z "$install_all" ]; then
candidates=$(comm -1 -2 $installed_list $avail_list)
fi

Return to:

Send suggestions and report system problems to the System administrator.