From 4c426ca1e3328b696b28a42944f7450ba572b028 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Fri, 8 Jul 2022 02:22:58 -0700 Subject: [PATCH] add another temporary sync-to-X-X script --- iso/empanadas/empanadas/util/dnf_utils.py | 25 ++++++++++++++++++ sync/sync-to-prod-9.sh | 32 +++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 sync/sync-to-prod-9.sh diff --git a/iso/empanadas/empanadas/util/dnf_utils.py b/iso/empanadas/empanadas/util/dnf_utils.py index 8bede72..6a8acb3 100644 --- a/iso/empanadas/empanadas/util/dnf_utils.py +++ b/iso/empanadas/empanadas/util/dnf_utils.py @@ -1430,6 +1430,16 @@ class RepoSync: 'live' ) + images_root = os.path.join( + work_root, + 'images' + ) + + sync_images_root = os.path.join( + sync_root, + 'images' + ) + global_work_root = os.path.join( work_root, "global", @@ -1470,6 +1480,21 @@ class RepoSync: else: self.log.info(Color.INFO + message) + # Sync the cloud images? + + if os.path.exists(images_root): + self.log.info(Color.INFO + 'Starting to sync cloud images to compose') + + if os.path.exists('/usr/bin/fpsync'): + message, ret = Shared.fpsync_method(images_root, sync_images_root, tmp_dir) + elif os.path.exists('/usr/bin/parallel') and os.path.exists('/usr/bin/rsync'): + message, ret = Shared.rsync_method(images_root, sync_images_root) + + if ret != 0: + self.log.error(Color.FAIL + message) + else: + self.log.info(Color.INFO + message) + # Combine all checksums here for arch in self.arches: iso_arch_root = os.path.join(sync_iso_root, arch) diff --git a/sync/sync-to-prod-9.sh b/sync/sync-to-prod-9.sh new file mode 100644 index 0000000..6eb70b8 --- /dev/null +++ b/sync/sync-to-prod-9.sh @@ -0,0 +1,32 @@ +#!/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}" + sudo -l && fpsync -o '-av --numeric-ids --no-compress --chown=10004:10005' -n 18 -t /mnt/compose/partitions "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/" "${TARGET}/" + + # Full file list update + cd "${PRODUCTION_ROOT}/${CATEGORY_STUB}/" || { echo "Failed to change directory"; exit 1; } + # Hardlink everything except xml files + hardlink -x '.*\.xml.*' "${REVISION}" + find . > fullfilelist + if [[ -f /usr/local/bin/create-filelist ]]; then + # We're already here, but Justin Case wanted this + cd "${PRODUCTION_ROOT}/${CATEGORY_STUB}/" || { echo "Failed to change directory"; exit 1; } + /bin/cp fullfiletimelist-rocky fullfiletimelist-rocky-old + /usr/local/bin/create-filelist > fullfiletimelist-rocky + cp fullfiletimelist-rocky fullfiletimelist + fi + chown 10004:10005 fullfilelist fullfiletimelist-rocky fullfiletimelist +fi +