From 11ff36adf8317214aa69805c5ad8616113378969 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 22 Jun 2017 09:25:03 +0200 Subject: bin/db-update: option "no-action" new --- bin/db-update | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/db-update b/bin/db-update index 65965c6..8c8c049 100755 --- a/bin/db-update +++ b/bin/db-update @@ -33,6 +33,7 @@ usage() { >&2 echo ' -f|--from $file: Read packages to move from testing to' >&2 echo ' stable from $file (- is stdin).' >&2 echo ' -h|--help: Show this help and exit.' + >&2 echo ' -n|--no-action: Only print what would be moved.' [ -z "$1" ] && exit 1 || exit $1 } @@ -57,6 +58,7 @@ move_packages() { rm -rf --one-file-system "${tmp_dir}/"* touch "${tmp_dir}/repos" + touch "${tmp_dir}/packages" for package in $@; do if [ -z "${package}" ]; then @@ -68,6 +70,15 @@ move_packages() { from_repo="${package##*/}" package="${package%/*}" + if ${no_action}; then + printf \ + 'move "%s" from "%s" to "%s"\n' \ + "${package}" \ + "${from_repo}" \ + "${to_repo}" + continue + fi + echo "${package}" >> \ "${tmp_dir}/packages" @@ -139,6 +150,10 @@ move_packages() { done + if ${no_action}; then + return 0 + fi + # receive the *.db.tar.gz's and *.files.tar.gz's while read -r repo; do @@ -249,15 +264,17 @@ move_packages() { } eval set -- "$( - getopt -o bf:h \ + getopt -o bf:hn \ --long block \ --long from: \ --long help \ + --long no-action \ -n "$(basename "$0")" -- "$@" || \ echo usage )" block_flag='-n' +no_action=false while true do @@ -276,6 +293,9 @@ do -h|--help) usage 0 ;; + -n|--no-action) + no_action=true + ;; --) shift break -- cgit v1.2.3-70-g09d2