toolkit/sync/beta-release-sync-to-staging.sh

93 lines
3.0 KiB
Bash
Raw Normal View History

2023-03-30 08:03:43 +00:00
#!/bin/bash
# Performs a full on sync of a minor release, directories and all. It calls the
# other scripts in this directory to assist where necessary.
# Note that this is EL8 specific
#
# Source common variables
# shellcheck disable=SC2046,1091,1090
2023-03-30 08:07:09 +00:00
export SHORT=Rocky
2023-09-03 22:06:20 +00:00
export RLREL=beta
2023-03-30 08:03:43 +00:00
source $(dirname "$0")/common
# Major Version (eg, 8)
MAJ=${RLVER}
2023-09-03 22:06:20 +00:00
if [[ "${RLVER}" -ne "8" ]]; then
echo "This is only used for Rocky Linux 8 releases."
exit 1
fi
2023-03-30 08:03:43 +00:00
# sync all pieces of a release, including extras, nfv, etc
for COMPOSE in "${NONSIG_COMPOSE[@]}"; do
echo "${COMPOSE}: Syncing"
SYNCSRC="/mnt/compose/${MAJ}-BETA/latest-${COMPOSE}-${MAJ}"
pushd "${SYNCSRC}/compose" || { echo "${COMPOSE}: Failed to change directory"; break; }
2023-03-30 08:03:43 +00:00
if [[ "${COMPOSE}" == "Rocky" ]]; then
# ISO Work before syncing
mkdir -p isos/{x86_64,aarch64}
# Sort the ISO's
for ARCH in "${ARCHES[@]}"; do
for x in BaseOS Minimal; do
2023-09-24 17:59:53 +00:00
if [[ "${x}" != "BaseOS" ]]; then
echo "${x} ${ARCH}: Removing unnecessary boot image"
2023-09-24 23:14:20 +00:00
/bin/rm -v "${x}/${ARCH}/iso/Rocky-${REVISION}-20"*"${ARCH}"*.iso
2023-09-24 17:59:53 +00:00
fi
2023-03-30 08:03:43 +00:00
echo "${x} ${ARCH}: Moving ISO images"
mv "${x}/${ARCH}/iso/"* "isos/${ARCH}/"
done
pushd "isos/${ARCH}" || { echo "${ARCH}: Failed to change directory"; break; }
# ln -s "Rocky-${REVISION}-${ARCH}-boot.iso" "Rocky-${ARCH}-boot.iso"
# ln -s "Rocky-${REVISION}-${ARCH}-dvd1.iso" "Rocky-${ARCH}-dvd1.iso"
# ln -s "Rocky-${REVISION}-${ARCH}-dvd1.iso" "Rocky-${ARCH}-dvd.iso"
# ln -s "Rocky-${REVISION}-${ARCH}-minimal.iso" "Rocky-${ARCH}-minimal.iso"
for file in *.iso; do
printf "# %s: %s bytes\n%s\n" \
"${file}" \
2023-05-18 00:47:48 +00:00
"$(stat -c %s ${file} -L)" \
2023-03-30 08:03:43 +00:00
"$(sha256sum --tag ${file})" \
| sudo tee -a CHECKSUM;
done
popd || { echo "Could not change directory"; break; }
done
mkdir -p live/x86_64
ln -s live Live
2023-03-30 08:03:43 +00:00
fi
popd || { echo "${COMPOSE}: Failed to change directory"; break; }
2023-03-30 08:03:43 +00:00
TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"
mkdir -p "${TARGET}"
pushd "${SYNCSRC}" || { echo "${COMPOSE}: Failed to change directory"; break; }
if [[ "${COMPOSE}" != "Rocky" ]]; then
rsync_no_delete_staging_with_excludes "${TARGET}" "metadata"
else
2023-09-21 22:28:39 +00:00
rsync_delete_staging "${TARGET}"
2023-03-30 08:03:43 +00:00
fi
popd || { echo "${COMPOSE}: Failed to change directory"; break; }
2023-03-30 08:03:43 +00:00
done
# Create symlinks for repos that were once separate from the main compose
2023-09-03 22:15:05 +00:00
for LINK in "${!LINK_REPOS[@]}"; do
2023-03-30 08:03:43 +00:00
ln -sr "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${LINK}" \
"${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${LINK_REPOS[$LINK]}"
done
# fix treeinfo
for ARCH in "${ARCHES[@]}"; do
echo "Ensuring treeinfo is correct"
treeinfoModder "${ARCH}"
treeinfoSaver "${ARCH}"
done
2023-09-04 06:14:49 +00:00
# Change Symlink if required
echo "Setting symlink to ${REV}"
pushd "${STAGING_ROOT}/${CATEGORY_STUB}" || exit
/bin/rm "${STAGING_ROOT}/${CATEGORY_STUB}/8-BETA"
ln -sr "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}" 8-BETA
echo "Attempting hard link"
perform_hardlink "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"
popd || exit