general sync script cleanup

This commit is contained in:
Louis Abel 2022-11-10 11:56:09 -07:00
parent 047287e464
commit ebeff58040
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
5 changed files with 95 additions and 6 deletions

View File

@ -51,6 +51,7 @@ ALL_REPOS=(
NONSIG_COMPOSE=( NONSIG_COMPOSE=(
Rocky Rocky
Extras
Rocky-devel Rocky-devel
Plus Plus
) )

View File

@ -21,6 +21,12 @@ for COMPOSE in "${NONSIG_COMPOSE[@]}"; do
sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \ sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \
{} "${TARGET}" {} "${TARGET}"
if [[ "${COMPOSE}" == "Rocky" ]]; then
cp COMPOSE_ID "${TARGET}"
chown 10004:10005 "${TARGET}/COMPOSE_ID"
rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}"
fi
# Return back to where we started # Return back to where we started
popd || { echo "${COMPOSE}: Failed to change back"; break; } popd || { echo "${COMPOSE}: Failed to change back"; break; }
done done

View File

@ -0,0 +1,42 @@
#!/bin/bash
# Syncs everything from staging to production
# Source common variables
# shellcheck disable=SC2046,1091,1090
source "$(dirname "$0")/common"
REV=${REVISION}${APPEND_TO_DIR}
cd "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}" || { echo "Failed to change directory"; ret_val=1; exit 1; }
ret_val=$?
if [ $ret_val -eq "0" ]; then
TARGET="${PRODUCTION_ROOT}/${CATEGORY_STUB}/${REV:0:3}"
mkdir -p "${TARGET}"
# disabling because none of our files should be starting with dashes. If they
# are something is *seriously* wrong here.
# shellcheck disable=SC2035
sudo -l && find ./ -mindepth 1 -maxdepth 1 -type d -exec find {}/ -mindepth 1 -maxdepth 1 -type d \;|sed 's/^..//g' | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable --delete \
{} "${TARGET}"
# shellcheck disable=SC2035
sudo -l && find ** -maxdepth 0 -type l | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \
{} "${TARGET}"
# Temporary until empanadas has this support
if [ -f "COMPOSE_ID" ]; then
cp COMPOSE_ID "${TARGET}"
chown 10004:10005 "${TARGET}/COMPOSE_ID"
fi
if [ -d "metadata" ]; then
rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}"
fi
# Full file list update for production root
cd "${PRODUCTION_ROOT}/${CATEGORY_STUB}/" || { echo "Failed to change directory"; exit 1; }
## Hardlink everything except xml files
echo "Hard linking"
hardlink -x '.*\.xml.*' "${REVISION}"
echo "Syncing to prod completed. Please run the file list script."
fi

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Source common variables
# shellcheck disable=SC2046,1091,1090
source "$(dirname "$0")/common"
if [[ $# -eq 0 ]]; then
echo "You must specify a short name."
exit 1
fi
# Major Version (eg, 8)
MAJ=${RLVER}
# Short name (eg, NFV, extras, Rocky, gluster9)
SHORT=${1}
cd "/mnt/compose/${MAJ}/latest-${SHORT}-${MAJ}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
ret_val=$?
if [ $ret_val -eq "0" ]; then
TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"
mkdir -p "${TARGET}"
# disabling because none of our files should be starting with dashes. If they
# are something is *seriously* wrong here.
# shellcheck disable=SC2035
sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable --delete \
{} "${TARGET}"
# This is temporary until we implement rsync into empanadas
if [ -f "COMPOSE_ID" ]; then
cp COMPOSE_ID "${TARGET}"
chown 10004:10005 "${TARGET}/COMPOSE_ID"
fi
if [ -d "metadata" ]; then
rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}"
fi
fi

View File

@ -27,6 +27,7 @@ if [ $ret_val -eq "0" ]; then
{} "${TARGET}" {} "${TARGET}"
# This is temporary until we implement rsync into empanadas # This is temporary until we implement rsync into empanadas
if [[ "${COMPOSE}" == "Rocky" ]]; then
if [ -f "COMPOSE_ID" ]; then if [ -f "COMPOSE_ID" ]; then
cp COMPOSE_ID "${TARGET}" cp COMPOSE_ID "${TARGET}"
chown 10004:10005 "${TARGET}/COMPOSE_ID" chown 10004:10005 "${TARGET}/COMPOSE_ID"
@ -35,4 +36,5 @@ if [ $ret_val -eq "0" ]; then
if [ -d "metadata" ]; then if [ -d "metadata" ]; then
rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}" rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}"
fi fi
fi
fi fi