From aee987fa6f2a850ba1fc48e4da89009cf63b6d68 Mon Sep 17 00:00:00 2001 From: Jan Houben Date: Thu, 31 May 2018 16:28:52 +0200 Subject: [PATCH] push.sh: Enable push of testing repository with '-t' --- push.sh | 17 ++++++++++++++++- repo.sh | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/push.sh b/push.sh index 7b640b6..7039a48 100755 --- a/push.sh +++ b/push.sh @@ -12,6 +12,7 @@ script_name=$(basename $0) script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" push=0 push_repo=0 +push_testing_repo=0 if ! source ${script_dir}/lib.sh; then @@ -32,6 +33,7 @@ usage() { echo " -n: Dryrun; Output commands, but don't do anything." echo " -d: Show debug info." echo " -r: Push the archzfs repositories." + echo " -t: Push the archzfs testing repositories." echo " -p: Commit changes and push." echo echo "Modes:" @@ -73,6 +75,8 @@ for (( a = 0; a < $#; a++ )); do push=1 elif [[ ${args[$a]} == "-r" ]]; then push_repo=1 + elif [[ ${args[$a]} == "-t" ]]; then + push_testing_repo=1 elif [[ ${args[$a]} == "-h" ]]; then usage else @@ -82,7 +86,7 @@ for (( a = 0; a < $#; a++ )); do done -if [[ ${#modes[@]} -eq 0 && ${push_repo} -eq 0 ]]; then +if [[ ${#modes[@]} -eq 0 && ${push_repo} -eq 0 && ${push_testing_repo} -eq 0 ]]; then echo error "A mode must be selected!" usage @@ -138,8 +142,19 @@ push_repo() { run_cmd_check 1 "Could not push packages to remote repo!" } +push_testing_repo() { + if [[ ${dry_run} -eq 1 ]]; then + dry="-n" + elif [[ ${push_testing_repo} -ne 1 ]]; then + return + fi + run_cmd "rsync -vrtlh --delete-before ${repo_basepath}/${repo_basename}-testing ${repo_basepath}/archive_${repo_basename}-testing ${remote_login}:${repo_remote_basepath}/ ${dry}" + run_cmd_check 1 "Could not push packages to remote testing repo!" +} + push_repo +push_testing_repo if [[ ${#modes[@]} -eq 0 ]]; then exit fi diff --git a/repo.sh b/repo.sh index 279d4f4..0de7276 100755 --- a/repo.sh +++ b/repo.sh @@ -96,7 +96,7 @@ for (( a = 0; a < $#; a++ )); do fi done -package_backup_dir="${repo_basepath}/archive_${repo_basename}" +package_backup_dir="${repo_basepath}/archive_${repo_name}" if [[ $# -lt 1 ]]; then