tools: Consolidate upload() function

Signed-off-by: Matt Turner <mattst88@gentoo.org>
This commit is contained in:
Matt Turner 2021-01-30 20:02:35 -05:00
parent 8f478fe30b
commit 7ec486fab4
15 changed files with 23 additions and 257 deletions

View file

@ -47,7 +47,6 @@ Options:
--interval <days> Exit if last successful run was less than <days> ago
-l|--lock <file> File to grab a lock on to prevent multiple invocations
-X|--nonetwork Do not perform network operations (like uploading result)
This needs to be supported by the config file as well.
-h|--help Show this message and quit
EOH
@ -270,6 +269,29 @@ verify_dnssec() {
fi
}
upload() {
if [[ ${nonetwork} == 0 ]]; then
echo Uploading "$@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
else
echo Would now upload "$@"
ls -l $@
fi
}
run_catalyst_commands() {
doneconfig=0
for config_file in "${config_files[@]}"; do

View file

@ -33,24 +33,6 @@ update_symlinks() {
done
}
upload() {
echo Uploading "$@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -65,24 +65,6 @@ update_symlinks() {
done
}
upload() {
echo " ** Uploading $@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -54,29 +54,6 @@ update_symlinks() {
done
}
upload() {
if [[ ${nonetwork} == 0 ]]; then
echo Uploading "$@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
else
echo Would now upload "$@"
ls -l $@
fi
}
post_build() {
local set=$1 spec=$2

View file

@ -28,23 +28,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -34,23 +34,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -27,23 +27,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -32,23 +32,6 @@ update_symlinks() {
popd >/dev/null
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -34,23 +34,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -55,29 +55,6 @@ update_symlinks() {
done
}
upload() {
if [[ ${nonetwork} == 0 ]]; then
echo Uploading "$@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
else
echo Would now upload "$@"
ls -l $@
fi
}
post_build() {
local set=$1 spec=$2

View file

@ -42,26 +42,6 @@ update_symlinks() {
done
}
upload() {
if [[ ${nonetwork} == 0 ]]; then
echo Uploading "$@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
fi
}
post_build() {
local set=$1 spec=$2

View file

@ -27,23 +27,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -27,23 +27,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -29,23 +29,6 @@ update_symlinks() {
done
}
upload() {
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2

View file

@ -52,24 +52,6 @@ update_symlinks() {
done
}
upload() {
echo " ** Uploading $@"
local SSH_CMD=(
ssh
-i ${UPLOAD_KEY}
-o UserKnownHostsFile=/dev/null
-o VerifyHostKeyDNS=yes
-o StrictHostKeyChecking=no
)
local RSYNC_OPTS=(
-e "${SSH_CMD[*]}"
--archive
--omit-dir-times
--delay-updates
)
rsync "${RSYNC_OPTS[@]}" "$@" ${UPLOAD_USER}@releng-incoming.gentoo.org:${UPLOAD_DEST}
}
post_build() {
local set=$1 spec=$2