commit:     a1b63fb90eddf827e465205f1f853236032ba2e3
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 21:10:47 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 21:10:47 2016 +0000
URL:        https://gitweb.gentoo.org/proj/releng.git/commit/?id=a1b63fb9

copy_buildsync.sh: convert code to use funcs

This makes the code a bit easier to follow and break up.

 scripts/copy_buildsync.sh | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index 6105197..a9c18a0 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -34,7 +34,21 @@ VERBOSEP=
 [ -n "$VERBOSE" ] && RSYNC_OPTS+=( -v )
 [ -n "$VERBOSEP" ] && VERBOSEP="-v"
 
-for ARCH in "${ARCHES[@]}"; do
+usage() {
+       cat <<EOF
+Usage: $0
+
+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.
+EOF
+       exit 1
+}
+
+process_arch() {
+       local ARCH=$1
+
        rc=0
        fail=0
 
@@ -147,7 +161,18 @@ for ARCH in "${ARCHES[@]}"; do
        else
                echo "There was some failure for $ARCH during the weekly sync. 
Not doing cleanup for fear of dataloss." 1>&2
        fi
+}
 
-done
+main() {
+       if [[ $# -ne 0 ]]; then
+               usage
+       fi
+
+       local arch
+       for arch in "${ARCHES[@]}"; do
+               process_arch "${arch}"
+       done
+}
+main "$@"
 
 # vim:ts=2 sw=2 noet ft=sh:

Reply via email to