diff options
author | Erich Eckner <git@eckner.net> | 2017-06-22 09:25:03 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-06-22 09:25:03 +0200 |
commit | 11ff36adf8317214aa69805c5ad8616113378969 (patch) | |
tree | e245f899e68136583441ebc42d197d991b5a2bc0 /bin/db-update | |
parent | bc7c6279b3f64e82701e0d26a0c12483f994eed3 (diff) | |
download | builder-11ff36adf8317214aa69805c5ad8616113378969.tar.xz |
bin/db-update: option "no-action" new
Diffstat (limited to 'bin/db-update')
-rwxr-xr-x | bin/db-update | 22 |
1 files changed, 21 insertions, 1 deletions
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 |