diff options
author | Eric Hameleers <alien@slackware.com> | 2013-05-22 12:00:55 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2013-05-22 12:00:55 +0000 |
commit | d0ab1349759cbbfce678dd989e11dbf13325d708 (patch) | |
tree | 52da5c9cc84681807c2db471165542ee695576d3 /compat32-tools | |
parent | 940e28bf48a8d632ca98541f1376f6606b95e61f (diff) | |
download | multilib-d0ab1349759cbbfce678dd989e11dbf13325d708.tar.gz multilib-d0ab1349759cbbfce678dd989e11dbf13325d708.tar.xz |
Add option '-n|--dry-run' to allow for a "dry run" which only displays the names of packages to convert without actually running the conversion
Diffstat (limited to 'compat32-tools')
-rwxr-xr-x | compat32-tools/massconvert32.sh | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/compat32-tools/massconvert32.sh b/compat32-tools/massconvert32.sh index 9fb1f99..f7d4d64 100755 --- a/compat32-tools/massconvert32.sh +++ b/compat32-tools/massconvert32.sh @@ -23,6 +23,9 @@ fi # Should we be verbose? VERBOSE=${VERBOSE:-1} +# Do we really convert the packages or only pretend to? +DRYRUN=0 + # In case we need temporary storage: TMP=${TMP:-/tmp} mkdir -p $TMP @@ -56,6 +59,8 @@ Optional parameter:: -d destination_directory create packages in this directory. By default, the new packages will be created in your current directory. + -n Dry-run (do not convert packages, just mention + their names). -q Only print output if packages are actually being converted (useful for cron jobs). @@ -80,6 +85,10 @@ while [ ! -z "$1" ]; do SLACK32ROOT="$(cd $(dirname "${2}"); pwd)/$(basename "${2}")" shift 2 ;; + -n|--dry-run) + DRYRUN=1 + shift + ;; -q|--quiet) VERBOSE=0 shift @@ -189,15 +198,23 @@ function conv_pkg () { then [ $VERBOSE -eq 1 ] && echo "--- ${BP}-compat32 version '$COMPAT32VERSION' already available" else - echo ">>> Deleting old version '$COMPAT32VERSION' of '${BP}-compat32'" + if [ $DRYRUN -eq 0 ]; then + echo ">>> Deleting old version '$COMPAT32VERSION' of '${BP}-compat32'" + else + echo "${BP}: existing package needs update" + fi FILE_TO_REMOVE=$HAVE_COMPAT32 HAVE_COMPAT32="" fi + else + if [ $DRYRUN -eq 1 ]; then + echo "${BP}: new package will be converted" + fi fi fi # If we do not have the latest -compat32 package, then run the conversion: - if [ ! -n "$HAVE_COMPAT32" ]; then + if [ ! -n "$HAVE_COMPAT32" -a $DRYRUN -eq 0 ]; then if [ -n "$SLACK32URL" ]; then # Download the Slackware package before converting it: @@ -495,7 +512,7 @@ for INPKG in $XAP_COMPAT32 ; do done # Mention downloaded packages if we used a URL as source: -if [ $VERBOSE -eq 1 -a -n "$SLACK32URL" ]; then +if [ $VERBOSE -eq 1 -a $DRYRUN -eq 0 -a -n "$SLACK32URL" ]; then echo "WARNING: packages which were downloaded from '$SLACK32URL'" echo "have been left in directory '$SLACK32ROOT'." echo "It is safe to remove these now." |