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.
This commit is contained in:
Mike Frysinger 2016-03-20 17:18:25 -04:00
parent a1b63fb90e
commit 2c172ab248

View file

@ -17,8 +17,6 @@ RSYNC_OPTS=(
-aO -aO
--delay-updates --delay-updates
) )
DEBUG=
VERBOSE=
EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]" EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]"
OUT_STAGE3="latest-stage3.txt" OUT_STAGE3="latest-stage3.txt"
@ -29,21 +27,20 @@ OUT_ISO="latest-iso.txt"
DEBUGP= DEBUGP=
VERBOSEP= VERBOSEP=
[ -n "$DEBUG" ] && DEBUGP=echo
[ -n "$DEBUG" ] && RSYNC_OPTS+=( -n )
[ -n "$VERBOSE" ] && RSYNC_OPTS+=( -v )
[ -n "$VERBOSEP" ] && VERBOSEP="-v"
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $0 Usage: $0 [options]
Move releases from the incoming upload directory to the outgoing release Move releases from the incoming upload directory to the outgoing release
directory so they can be pushed out to mirrors. directory so they can be pushed out to mirrors.
Also update the "latest" links/files so people can easily find the current Also update the "latest" links/files so people can easily find the current
version for any particular arch/release. version for any particular arch/release.
Options:
-v, --verbose Run in verbose mode
-d, --debug Run in debug mode
EOF EOF
exit 1 exit ${1:-1}
} }
process_arch() { process_arch() {
@ -164,10 +161,28 @@ process_arch() {
} }
main() { main() {
if [[ $# -ne 0 ]]; then # Process all the command line options first.
usage while [[ $# -ne 0 ]]; do
fi 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 local arch
for arch in "${ARCHES[@]}"; do for arch in "${ARCHES[@]}"; do
process_arch "${arch}" process_arch "${arch}"