diff --git a/sync/common b/sync/common index e909ecd..da2ddd1 100644 --- a/sync/common +++ b/sync/common @@ -69,12 +69,12 @@ VARIANTS=(boot minimal dvd1) # Syncing functions function parallel_rsync_no_delete_staging() { - TARGET="${1}" + local 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}" + local 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}" @@ -86,36 +86,42 @@ function parallel_rsync_delete_staging() { } function parallel_rsync_delete_prod() { - TARGET="${1}" + local 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}" + local TARGET="${1}" sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable compose/ "${TARGET}" } +function rsync_no_delete_staging_with_excludes() { + local TARGET="${1}" + local EXCLUDE="${2}" + sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable --exclude "${EXCLUDE}" compose/ "${TARGET}" +} + function rsync_no_delete_prod() { - REV="${1}" - TARGET="${2}" + local REV="${1}" + local TARGET="${2}" sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable "${REV}/" "${TARGET}" } function rsync_delete_staging() { - TARGET="${1}" + local TARGET="${1}" sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable --delete compose/ "${TARGET}" } function rsync_delete_prod() { - REV="${1}" - TARGET="${2}" + local REV="${1}" + local TARGET="${2}" sudo -l && rsync -vrlptDSH --chown=10004:10005 --progress --human-readable --delete "${REV}/" "${TARGET}" } function perform_hardlink() { - TARGET="${1}" + local TARGET="${1}" hardlink -x '.*\.xml.*' "${TARGET}" } @@ -124,6 +130,7 @@ 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_staging_with_excludes export -f rsync_no_delete_prod export -f rsync_delete_staging export -f rsync_delete_prod diff --git a/sync/minor-release-sync-to-staging.sh b/sync/minor-release-sync-to-staging.sh index 846d457..b7b15dd 100644 --- a/sync/minor-release-sync-to-staging.sh +++ b/sync/minor-release-sync-to-staging.sh @@ -10,10 +10,16 @@ source $(dirname "$0")/common # Major Version (eg, 8) MAJ=${RLVER} +if [ "${MAJ}" == "9" ]; then + echo "Does not work for Rocky Linux 9. Please use sync-to-staging" + exit 32 +fi + # sync all pieces of a release, including extras, nfv, etc for COMPOSE in "${NONSIG_COMPOSE[@]}"; do echo "${COMPOSE}: Syncing" - pushd "${RELEASE_COMPOSE_ROOT}/compose" || { echo "${COMPOSE}: Failed to change directory"; break; } + SYNCSRC="/mnt/compose/${MAJ}/latest-${COMPOSE}-${MAJ}" + pushd "${SYNCSRC}/compose" || { echo "${COMPOSE}: Failed to change directory"; break; } if [[ "${COMPOSE}" == "Rocky" ]]; then # ISO Work before syncing @@ -39,30 +45,20 @@ for COMPOSE in "${NONSIG_COMPOSE[@]}"; do done popd || { echo "Could not change directory"; break; } done + mkdir -p live/x86_64 + ln -s live Live fi + popd || { echo "${COMPOSE}: Failed to change directory"; break; } 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 \ - {} "${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}" + pushd "${SYNCSRC}" || { echo "${COMPOSE}: Failed to change directory"; break; } + if [[ "${COMPOSE}" != "Rocky" ]]; then + rsync_no_delete_staging_with_excludes "${TARGET}" "metadata" + else + rsync_no_delete_staging "${TARGET}" fi - - # Return back to where we started - popd || { echo "${COMPOSE}: Failed to change back"; break; } - - # Create extra stuff - pushd "${TARGET}" || { echo "${COMPOSE}: Failed to change directory"; break; } - mkdir -p Live/x86_64 - ln -s Live live - popd || { echo "${COMPOSE}: Failed to change back"; break; } + popd || { echo "${COMPOSE}: Failed to change directory"; break; } done diff --git a/sync/sync-to-staging.sh b/sync/sync-to-staging.sh index 8ecadc5..c13f405 100644 --- a/sync/sync-to-staging.sh +++ b/sync/sync-to-staging.sh @@ -23,6 +23,6 @@ if [ $ret_val -eq "0" ]; then TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}" mkdir -p "${TARGET}" rsync_no_delete_staging "${TARGET}" - echo "Hardlinking staging directory" + echo "Hardlinking staging directory (${TARGET})" perform_hardlink "${TARGET}" fi