aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-03-20 17:18:25 -0400
committerMike Frysinger <vapier@gentoo.org>2016-03-20 17:18:25 -0400
commit2c172ab2489162b77d7e2f60642ae8b42db3e761 (patch)
tree17a2cecb2f234ae308e0620e5d679a1e53e2cff4 /scripts
parentcopy_buildsync.sh: convert code to use funcs (diff)
downloadreleng-2c172ab2489162b77d7e2f60642ae8b42db3e761.tar.gz
releng-2c172ab2489162b77d7e2f60642ae8b42db3e761.tar.bz2
releng-2c172ab2489162b77d7e2f60642ae8b42db3e761.zip
copy_buildsync.sh: add command line options for verbose/debug mode
This makes it easier to do some debugging on the fly w/out having to edit the script directly.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/copy_buildsync.sh39
1 files changed, 27 insertions, 12 deletions
diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index a9c18a0d..b2e5f8a3 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -17,8 +17,6 @@ RSYNC_OPTS=(
-aO
--delay-updates
)
-DEBUG=
-VERBOSE=
EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]"
OUT_STAGE3="latest-stage3.txt"
@@ -29,21 +27,20 @@ OUT_ISO="latest-iso.txt"
DEBUGP=
VERBOSEP=
-[ -n "$DEBUG" ] && DEBUGP=echo
-[ -n "$DEBUG" ] && RSYNC_OPTS+=( -n )
-[ -n "$VERBOSE" ] && RSYNC_OPTS+=( -v )
-[ -n "$VERBOSEP" ] && VERBOSEP="-v"
-
usage() {
cat <<EOF
-Usage: $0
+Usage: $0 [options]
Move releases from the incoming upload directory to the outgoing release
directory so they can be pushed out to mirrors.
Also update the "latest" links/files so people can easily find the current
version for any particular arch/release.
+
+Options:
+ -v, --verbose Run in verbose mode
+ -d, --debug Run in debug mode
EOF
- exit 1
+ exit ${1:-1}
}
process_arch() {
@@ -164,10 +161,28 @@ process_arch() {
}
main() {
- if [[ $# -ne 0 ]]; then
- usage
- fi
+ # Process all the command line options first.
+ while [[ $# -ne 0 ]]; do
+ case $1 in
+ -d|--debug)
+ DEBUGP="echo"
+ RSYNC_OPTS+=( -n )
+ ;;
+ -v|--verbose)
+ VERBOSEP="-v"
+ RSYNC_OPTS+=( -v )
+ ;;
+ -h|--help)
+ usage 0
+ ;;
+ *)
+ usage 1
+ ;;
+ esac
+ shift
+ done
+ # Process all the architectures.
local arch
for arch in "${ARCHES[@]}"; do
process_arch "${arch}"