From d14007c774e6d255e8a3fdc5890b06b1629f8348 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 20 Mar 2016 16:46:11 -0400 Subject: [PATCH] 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 69b08c9e..61051971 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