diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-03-28 18:13:07 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-03-28 18:13:07 +0200 |
commit | ed034ffb5f04fb58d5f43fa10b6f10e2560928b0 (patch) | |
tree | 75e2e1d0ea9dc9e4a0720bf47df9a8f8464d92f7 | |
parent | 09f698bebd13d7e9036728501a8e728edcf1bfeb (diff) | |
download | slackupgrade-ed034ffb5f04fb58d5f43fa10b6f10e2560928b0.tar.gz slackupgrade-ed034ffb5f04fb58d5f43fa10b6f10e2560928b0.tar.bz2 |
Fix the -k option.
* slackupgrade: Fix declaration of the -k option
Change the value of keep_file to the absolute path name.
-rw-r--r-- | slackupgrade | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/slackupgrade b/slackupgrade index 9be3e98..f00e20b 100644 --- a/slackupgrade +++ b/slackupgrade | |||
@@ -416,2 +416,16 @@ function download_all() { | |||
416 | 416 | ||
417 | function abspath() { | ||
418 | local name=$1 | ||
419 | local val | ||
420 | eval val=\$$name | ||
421 | case $val in | ||
422 | /*) ;; | ||
423 | *) local dir=$(dirname $val) | ||
424 | dir=$(cd $dir 2>/dev/null && pwd) || abend "can't canonicalize $val" | ||
425 | val=$dir/$(basename $val) | ||
426 | eval $name=$val | ||
427 | ;; | ||
428 | esac | ||
429 | } | ||
430 | |||
417 | # ########## | 431 | # ########## |
@@ -420,3 +434,3 @@ function download_all() { | |||
420 | 434 | ||
421 | while getopts "ahIknp:qSs:vy" OPTION | 435 | while getopts "ahIk:np:qSs:vy" OPTION |
422 | do | 436 | do |
@@ -428,3 +442,4 @@ do | |||
428 | exit 0;; | 442 | exit 0;; |
429 | k) keep_file=$OPTARG;; | 443 | k) keep_file=$OPTARG |
444 | abspath keep_file;; | ||
430 | n) dry_run=y;; | 445 | n) dry_run=y;; |
@@ -453,2 +468,6 @@ fi | |||
453 | 468 | ||
469 | if [ -n "$keep_file" ] && [ ! -f "$keep_file" ]; then | ||
470 | abend "keep file \"$keep_file\" doesn't exist or is unreadable" | ||
471 | fi | ||
472 | |||
454 | # Sanity check | 473 | # Sanity check |
@@ -598,3 +617,3 @@ fi) | sort -u > candidates.$$ | |||
598 | comm -2 -3 $installed_list candidates.$$ > remove.list.$$ | 617 | comm -2 -3 $installed_list candidates.$$ > remove.list.$$ |
599 | if [ -s "$keep_file" ]; then | 618 | if [ -n "$keep_file" ] && [ -s "$keep_file" ]; then |
600 | grep -v '^#' $keep_file | \ | 619 | grep -v '^#' $keep_file | \ |