commit:     d14007c774e6d255e8a3fdc5890b06b1629f8348
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 20:46:11 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 20:46:11 2016 +0000
URL:        https://gitweb.gentoo.org/proj/releng.git/commit/?id=d14007c7

copy_buildsync.sh: convert code to use arrays

This makes it a bit cleaner to work with arguments.

 scripts/copy_buildsync.sh | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index 69b08c9..6105197 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -1,8 +1,22 @@
 #!/bin/bash
 
-ARCHES="alpha amd64 arm hppa ia64      ppc s390 sh sparc x86"
-       #alpha amd64 arm hppa ia64 mips ppc s390 sh sparc x86
-RSYNC_OPTS="-aO --delay-updates"
+ARCHES=(
+       alpha
+       amd64
+       arm
+       hppa
+       ia64
+       #mips
+       ppc
+       s390
+       sh
+       sparc
+       x86
+)
+RSYNC_OPTS=(
+       -aO
+       --delay-updates
+)
 DEBUG=
 VERBOSE=
 EXTENSIONS="[.tar.xz,.tar.bz2,.tar.gz,.tar,.sfs]"
@@ -16,11 +30,11 @@ DEBUGP=
 VERBOSEP=
 
 [ -n "$DEBUG" ] && DEBUGP=echo
-[ -n "$DEBUG" ] && RSYNC_OPTS="${RSYNC_OPTS} -n"
-[ -n "$VERBOSE" ] && RSYNC_OPTS="${RSYNC_OPTS} -v"
+[ -n "$DEBUG" ] && RSYNC_OPTS+=( -n )
+[ -n "$VERBOSE" ] && RSYNC_OPTS+=( -v )
 [ -n "$VERBOSEP" ] && VERBOSEP="-v"
 
-for ARCH in $ARCHES; do
+for ARCH in "${ARCHES[@]}"; do
        rc=0
        fail=0
 
@@ -36,7 +50,7 @@ for ARCH in $ARCHES; do
                        #echo "Doing $i"
                        t="${outdir}/${i}"
                        mkdir -p ${t} 2>/dev/null
-                       rsync ${RSYNC_OPTS} --temp-dir=${tmpdir} 
--partial-dir=${tmpdir} ${indir}/ --filter "S *${i}*" --filter 'S **/' --filter 
'H *' ${t}
+                       rsync "${RSYNC_OPTS[@]}" --temp-dir=${tmpdir} 
--partial-dir=${tmpdir} ${indir}/ --filter "S *${i}*" --filter 'S **/' --filter 
'H *' ${t}
                        rc=$?
                        if [ $rc -eq 0 ]; then
                                find ${indir} -type f -name "*${i}*" -print0 | 
xargs -0 --no-run-if-empty $DEBUGP rm $VERBOSEP -f

Reply via email to