catalyst-auto-{amd64,x86}*.conf: change cmd array to upload function

Use an easier-to-read "upload" function in place of "${cmd[@]}" array
syntax.  Added a helper var UPLOAD_DEST to be set in advance so that
upload function takes only a list of filenames to be uploaded.

Signed-off-by: Ben Kohler <bkohler@gentoo.org>
This commit is contained in:
Ben Kohler 2020-05-15 12:34:12 -05:00
parent 151b13ac96
commit 60a1326315
No known key found for this signature in database
GPG key ID: 7A85BDA4D57605C7
4 changed files with 86 additions and 68 deletions

View file

@ -48,16 +48,19 @@ update_symlinks() {
done
}
upload() {
rsync \
-e 'ssh -i /root/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o VerifyHostKeyDNS=yes -o StrictHostKeyChecking=no' \
-a \
--omit-dir-times \
--delay-updates \
"$@" \
"${UPLOAD_DEST}"
}
post_build() {
local set=$1 spec=$2
cmd=(
rsync
-e 'ssh -i /root/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o VerifyHostKeyDNS=yes -o StrictHostKeyChecking=no'
-a
--omit-dir-times
--delay-updates
)
case $HOSTNAME in
# If you ever need to ensure it's copied somewhere local, drop a hostname in here!
LOCAL)
@ -71,26 +74,28 @@ post_build() {
esac
pushd "${BUILD_SRCDIR_BASE}"/default >/dev/null || exit
UPLOAD_DEST=${DEST_DEFAULT}
case ${spec} in
stage3.spec)
"${cmd[@]}" stage3-i486-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-i486-${TIMESTAMP}.tar.xz*
;;
installcd-stage2-minimal.spec)
"${cmd[@]}" install-x86-minimal-${TIMESTAMP}.iso* "${DEST_DEFAULT}"
upload install-x86-minimal-${TIMESTAMP}.iso*
;;
i686/stage3.spec)
"${cmd[@]}" stage3-i686-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-i686-${TIMESTAMP}.tar.xz*
;;
esac
popd >/dev/null || exit
pushd "${BUILD_SRCDIR_BASE}"/hardened >/dev/null || exit
UPLOAD_DEST=${DEST_HARDENED}
case ${spec} in
hardened/stage3.spec)
"${cmd[@]}" stage3-i686-hardened-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-i686-hardened-${TIMESTAMP}.tar.xz*
;;
hardened/admincd-stage2.spec)
"${cmd[@]}" admincd-x86-${TIMESTAMP}.iso* "${DEST_HARDENED}"
upload admincd-x86-${TIMESTAMP}.iso*
;;
esac
popd >/dev/null || exit