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

@ -26,7 +26,6 @@ SET_minimal_nomultilib_OPTIONAL_SPECS="stage4-nomultilib-minimal.spec"
SET_x32_SPECS="stage1-x32.spec stage2-x32.spec stage3-x32.spec"
SET_hardened_multilib_SPECS="hardened/stage1.spec hardened/stage2.spec hardened/stage3.spec"
SET_hardened_multilib_OPTIONAL_SPECS="hardened/admincd-stage1.spec hardened/admincd-stage2.spec"
SET_minimal_hardened_multilib_OPTIONAL_SPECS="hardened/stage4-minimal.spec"
@ -62,16 +61,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)
@ -85,53 +87,55 @@ post_build() {
esac
pushd "${BUILD_SRCDIR_BASE}"/default >/dev/null || exit
UPLOAD_DEST=${DEST_DEFAULT}
case ${spec} in
stage3.spec)
"${cmd[@]}" stage3-amd64-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-amd64-${TIMESTAMP}.tar.xz*
;;
installcd-stage2-minimal.spec)
"${cmd[@]}" install-amd64-minimal-${TIMESTAMP}.iso* "${DEST_DEFAULT}"
upload install-amd64-minimal-${TIMESTAMP}.iso*
;;
stage4-minimal.spec)
"${cmd[@]}" stage4-amd64-minimal-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage4-amd64-minimal-${TIMESTAMP}.tar.xz*
;;
stage3-nomultilib.spec)
"${cmd[@]}" stage3-amd64-nomultilib-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-amd64-nomultilib-${TIMESTAMP}.tar.xz*
;;
stage4-nomultilib-minimal.spec)
"${cmd[@]}" stage4-amd64-minimal-nomultilib-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage4-amd64-minimal-nomultilib-${TIMESTAMP}.tar.xz*
;;
stage3-x32.spec)
"${cmd[@]}" stage3-x32-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-x32-${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-amd64-hardened-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened-${TIMESTAMP}.tar.xz*
;;
hardened/admincd-stage2.spec)
"${cmd[@]}" admincd-amd64-${TIMESTAMP}.iso* "${DEST_HARDENED}"
upload admincd-amd64-${TIMESTAMP}.iso*
;;
hardened/stage4-minimal.spec)
"${cmd[@]}" stage4-amd64-hardened+minimal-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage4-amd64-hardened+minimal-${TIMESTAMP}.tar.xz*
;;
hardened/stage3-nomultilib.spec)
"${cmd[@]}" stage3-amd64-hardened+nomultilib-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened+nomultilib-${TIMESTAMP}.tar.xz*
;;
hardened/stage4-nomultilib-minimal.spec)
"${cmd[@]}" stage4-amd64-hardened+minimal-nomultilib-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage4-amd64-hardened+minimal-nomultilib-${TIMESTAMP}.tar.xz*
;;
hardened/stage3-selinux.spec)
"${cmd[@]}" stage3-amd64-hardened-selinux-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened-selinux-${TIMESTAMP}.tar.xz*
;;
hardened/admincd-stage2-selinux.spec)
"${cmd[@]}" admincd-amd64-${TIMESTAMP}.iso* "${DEST_HARDENED}"
upload admincd-amd64-${TIMESTAMP}.iso*
;;
hardened/stage3-selinux-nomultilib.spec)
"${cmd[@]}" stage3-amd64-hardened-selinux+nomultilib-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened-selinux+nomultilib-${TIMESTAMP}.tar.xz*
;;
esac
popd >/dev/null || exit

View file

@ -26,7 +26,6 @@ SET_minimal_nomultilib_OPTIONAL_SPECS="stage4-nomultilib-minimal.spec"
SET_x32_SPECS="stage1-x32.spec stage2-x32.spec stage3-x32.spec"
SET_hardened_multilib_SPECS="hardened/stage1.spec hardened/stage2.spec hardened/stage3.spec"
SET_hardened_multilib_OPTIONAL_SPECS="hardened/admincd-stage1.spec hardened/admincd-stage2.spec"
SET_minimal_hardened_multilib_OPTIONAL_SPECS="hardened/stage4-minimal.spec"
@ -62,16 +61,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)
@ -85,53 +87,55 @@ post_build() {
esac
pushd "${BUILD_SRCDIR_BASE}"/default >/dev/null || exit
UPLOAD_DEST=${DEST_DEFAULT}
case ${spec} in
stage3.spec)
"${cmd[@]}" stage3-amd64-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-amd64-${TIMESTAMP}.tar.xz*
;;
installcd-stage2-minimal.spec)
"${cmd[@]}" install-amd64-minimal-${TIMESTAMP}.iso* "${DEST_DEFAULT}"
upload install-amd64-minimal-${TIMESTAMP}.iso*
;;
stage4-minimal.spec)
"${cmd[@]}" stage4-amd64-minimal-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage4-amd64-minimal-${TIMESTAMP}.tar.xz*
;;
stage3-nomultilib.spec)
"${cmd[@]}" stage3-amd64-nomultilib-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-amd64-nomultilib-${TIMESTAMP}.tar.xz*
;;
stage4-nomultilib-minimal.spec)
"${cmd[@]}" stage4-amd64-minimal-nomultilib-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage4-amd64-minimal-nomultilib-${TIMESTAMP}.tar.xz*
;;
stage3-x32.spec)
"${cmd[@]}" stage3-x32-${TIMESTAMP}.tar.xz* "${DEST_DEFAULT}"
upload stage3-x32-${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-amd64-hardened-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened-${TIMESTAMP}.tar.xz*
;;
hardened/admincd-stage2.spec)
"${cmd[@]}" admincd-amd64-${TIMESTAMP}.iso* "${DEST_HARDENED}"
upload admincd-amd64-${TIMESTAMP}.iso*
;;
hardened/stage4-minimal.spec)
"${cmd[@]}" stage4-amd64-hardened+minimal-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage4-amd64-hardened+minimal-${TIMESTAMP}.tar.xz*
;;
hardened/stage3-nomultilib.spec)
"${cmd[@]}" stage3-amd64-hardened+nomultilib-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened+nomultilib-${TIMESTAMP}.tar.xz*
;;
hardened/stage4-nomultilib-minimal.spec)
"${cmd[@]}" stage4-amd64-hardened+minimal-nomultilib-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage4-amd64-hardened+minimal-nomultilib-${TIMESTAMP}.tar.xz*
;;
hardened/stage3-selinux.spec)
"${cmd[@]}" stage3-amd64-hardened-selinux-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened-selinux-${TIMESTAMP}.tar.xz*
;;
hardened/admincd-stage2-selinux.spec)
"${cmd[@]}" admincd-amd64-${TIMESTAMP}.iso* "${DEST_HARDENED}"
upload admincd-amd64-${TIMESTAMP}.iso*
;;
hardened/stage3-selinux-nomultilib.spec)
"${cmd[@]}" stage3-amd64-hardened-selinux+nomultilib-${TIMESTAMP}.tar.xz* "${DEST_HARDENED}"
upload stage3-amd64-hardened-selinux+nomultilib-${TIMESTAMP}.tar.xz*
;;
esac
popd >/dev/null || exit

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

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