add another temporary sync-to-X-X script

This commit is contained in:
Louis Abel 2022-07-08 02:22:58 -07:00
parent aaa89c74a4
commit 4c426ca1e3
Signed by: label
GPG Key ID: B37E62D143879B36
2 changed files with 57 additions and 0 deletions

View File

@ -1430,6 +1430,16 @@ class RepoSync:
'live' 'live'
) )
images_root = os.path.join(
work_root,
'images'
)
sync_images_root = os.path.join(
sync_root,
'images'
)
global_work_root = os.path.join( global_work_root = os.path.join(
work_root, work_root,
"global", "global",
@ -1470,6 +1480,21 @@ class RepoSync:
else: else:
self.log.info(Color.INFO + message) 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 # Combine all checksums here
for arch in self.arches: for arch in self.arches:
iso_arch_root = os.path.join(sync_iso_root, arch) iso_arch_root = os.path.join(sync_iso_root, arch)

32
sync/sync-to-prod-9.sh Normal file
View File

@ -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