forked from sig_core/toolkit
move syncing into common
This commit is contained in:
parent
f152ff5a44
commit
e756e71203
4 changed files with 83 additions and 24 deletions
BIN
func/common/.imports.sh.swp
Normal file
BIN
func/common/.imports.sh.swp
Normal file
Binary file not shown.
57
sync/common
57
sync/common
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
# To be sourced by scripts to use
|
||||
|
||||
# Variables that can be overriden should be noted with optional context. It is
|
||||
|
@ -65,3 +66,59 @@ MODS=(
|
|||
# Used to iterate over ISOs?
|
||||
# Override: Allowed
|
||||
VARIANTS=(boot minimal dvd1)
|
||||
|
||||
# Syncing functions
|
||||
function parallel_rsync_no_delete_staging() {
|
||||
TARGET="${1}"
|
||||
sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable {} "${TARGET}"
|
||||
}
|
||||
|
||||
function parallel_rsync_no_delete_prod() {
|
||||
TARGET="${1}"
|
||||
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 {} "${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}"
|
||||
}
|
||||
|
||||
function parallel_rsync_delete_staging() {
|
||||
TARGET="${1}"
|
||||
sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable --delete {} "${TARGET}"
|
||||
}
|
||||
|
||||
function parallel_rsync_delete_prod() {
|
||||
TARGET="${1}"
|
||||
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}"
|
||||
}
|
||||
|
||||
function rsync_no_delete_staging() {
|
||||
TARGET="${1}"
|
||||
sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable compose/ "${TARGET}"
|
||||
}
|
||||
|
||||
function rsync_no_delete_prod() {
|
||||
REV="${1}"
|
||||
TARGET="${2}"
|
||||
sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable "${REV}/" "${TARGET}"
|
||||
}
|
||||
|
||||
function rsync_delete_staging() {
|
||||
TARGET="${1}"
|
||||
sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable --delete compose/ "${TARGET}"
|
||||
}
|
||||
|
||||
function rsync_delete_prod() {
|
||||
REV="${1}"
|
||||
TARGET="${2}"
|
||||
sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable --delete "${REV}/" "${TARGET}"
|
||||
}
|
||||
|
||||
export -f parallel_rsync_no_delete_staging
|
||||
export -f parallel_rsync_no_delete_prod
|
||||
export -f parallel_rsync_delete_staging
|
||||
export -f parallel_rsync_delete_prod
|
||||
export -f rsync_no_delete_staging
|
||||
export -f rsync_no_delete_prod
|
||||
export -f rsync_delete_staging
|
||||
export -f rsync_delete_prod
|
||||
|
|
|
@ -15,7 +15,8 @@ fi
|
|||
# Major Version (eg, 8)
|
||||
MAJ=${RLVER}
|
||||
|
||||
cd "${RELEASE_COMPOSE_ROOT}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
||||
#cd "${RELEASE_COMPOSE_ROOT}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
||||
cd "${RELEASE_COMPOSE_ROOT}/" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
||||
ret_val=$?
|
||||
|
||||
if [ $ret_val -eq "0" ]; then
|
||||
|
@ -23,17 +24,17 @@ if [ $ret_val -eq "0" ]; then
|
|||
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}"
|
||||
#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 [ -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
|
||||
#if [ -d "metadata" ]; then
|
||||
# rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}"
|
||||
#fi
|
||||
rsync_delete_staging "${TARGET}"
|
||||
fi
|
||||
|
|
|
@ -15,27 +15,28 @@ fi
|
|||
# Major Version (eg, 8)
|
||||
MAJ=${RLVER}
|
||||
|
||||
cd "${RELEASE_COMPOSE_ROOT}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
||||
#cd "${RELEASE_COMPOSE_ROOT}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
||||
cd "${RELEASE_COMPOSE_ROOT}/" || { 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}"
|
||||
rsync_no_delete_staging "${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 \
|
||||
{} "${TARGET}"
|
||||
#sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \
|
||||
# {} "${TARGET}"
|
||||
|
||||
# This is temporary until we implement rsync into empanadas
|
||||
if [[ "${COMPOSE}" == "Rocky" ]]; then
|
||||
if [ -f "COMPOSE_ID" ]; then
|
||||
cp COMPOSE_ID "${TARGET}"
|
||||
chown 10004:10005 "${TARGET}/COMPOSE_ID"
|
||||
fi
|
||||
#if [[ "${COMPOSE}" == "Rocky" ]]; then
|
||||
# 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
|
||||
# if [ -d "metadata" ]; then
|
||||
# rsync -av --chown=10004:10005 --progress --relative --human-readable metadata "${TARGET}"
|
||||
# fi
|
||||
# fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue