toolkit/sync/minor-release-sync-to-stagi...

113 lines
3.8 KiB
Bash
Raw Permalink Normal View History

2021-07-06 19:24:29 +00:00
#!/bin/bash
# Performs a full on sync of a minor release, directories and all. It calls the
2021-07-12 06:58:08 +00:00
# other scripts in this directory to assist where necessary.
# Note that this is EL8 specific
#
2021-07-06 19:24:29 +00:00
# Source common variables
2021-07-06 20:33:22 +00:00
# shellcheck disable=SC2046,1091,1090
source $(dirname "$0")/common
2021-07-06 19:24:29 +00:00
2021-07-12 06:58:08 +00:00
# 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
2021-07-06 19:24:29 +00:00
# sync all pieces of a release, including extras, nfv, etc
2021-11-10 23:51:32 +00:00
for COMPOSE in "${NONSIG_COMPOSE[@]}"; do
2021-11-10 19:26:09 +00:00
echo "${COMPOSE}: Syncing"
SYNCSRC="/mnt/compose/${MAJ}/latest-${COMPOSE}-${MAJ}"
pushd "${SYNCSRC}/compose" || { echo "${COMPOSE}: Failed to change directory"; break; }
2021-07-12 06:58:08 +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
echo "${x} ${ARCH}: Moving ISO images"
2022-11-10 22:35:51 +00:00
mv "${x}/${ARCH}/iso/"* "isos/${ARCH}/"
done
pushd "isos/${ARCH}" || { echo "${ARCH}: Failed to change directory"; break; }
2023-12-26 08:06:43 +00:00
# old deprecated way
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"
2023-12-26 08:06:43 +00:00
# new way
ln -s "Rocky-${REVISION}-${ARCH}-boot.iso" "Rocky-${MAJ}-latest-${ARCH}-boot.iso"
ln -s "Rocky-${REVISION}-${ARCH}-dvd1.iso" "Rocky-${MAJ}-latest-${ARCH}-dvd.iso"
ln -s "Rocky-${REVISION}-${ARCH}-minimal.iso" "Rocky-${MAJ}-latest-${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)" \
"$(sha256sum --tag ${file})" \
| sudo tee -a "${file}.CHECKSUM"
done
2023-11-18 21:51:57 +00:00
cat *.CHECKSUM > CHECKSUM
popd || { echo "Could not change directory"; break; }
done
rm -rf Minimal
mkdir -p live/x86_64
ln -s live Live
fi
popd || { echo "${COMPOSE}: Failed to change directory"; break; }
2021-07-12 06:58:08 +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
rsync_no_delete_staging "${TARGET}"
2022-11-10 18:56:09 +00:00
fi
popd || { echo "${COMPOSE}: Failed to change directory"; break; }
2021-07-12 06:58:08 +00:00
done
2021-11-10 23:56:31 +00:00
2022-05-12 07:18:34 +00:00
# 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
2022-05-12 07:18:34 +00:00
ln -sr "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${LINK}" \
"${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${LINK_REPOS[$LINK]}"
done
2021-08-02 23:03:51 +00:00
# make a kickstart directory
for ARCH in "${ARCHES[@]}"; do
2021-08-02 23:06:21 +00:00
for REPO in "${MODS_REPOS[@]}"; do
2021-08-02 23:03:51 +00:00
SOURCE="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${REPO}/${ARCH}/os"
TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${REPO}/${ARCH}/kickstart"
2021-11-10 19:26:09 +00:00
echo "Making golden kickstart directory"
2023-05-18 01:40:56 +00:00
rsync -vrlptDSH --chown=10004:10005 --progress --human-readable "${SOURCE}/" "${TARGET}"
2021-08-02 23:03:51 +00:00
done
done
2021-07-12 07:50:40 +00:00
# fix treeinfo
for ARCH in "${ARCHES[@]}"; do
2021-11-10 19:26:09 +00:00
echo "Ensuring treeinfo is correct"
2021-07-12 07:50:40 +00:00
treeinfoModder "${ARCH}"
treeinfoModderKickstart "${ARCH}"
2021-11-14 05:43:11 +00:00
treeinfoSaver "${ARCH}"
2021-07-12 07:50:40 +00:00
done
2021-07-12 06:58:08 +00:00
# sign all repos
2021-11-10 19:26:09 +00:00
echo "Signing all repositories"
2021-07-12 06:58:08 +00:00
test -f $(dirname "$0")/sign-repos-only.sh
ret_val=$?
2021-07-06 19:24:29 +00:00
2021-07-12 06:58:08 +00:00
if [ "$ret_val" -eq 0 ]; then
$(dirname "$0")/sign-repos-only.sh
fi
2021-11-01 20:12:48 +00:00
# Change Symlink if required
2021-11-10 19:26:09 +00:00
echo "Setting symlink to ${REV}"
2021-11-10 23:51:59 +00:00
pushd "${STAGING_ROOT}/${CATEGORY_STUB}" || exit
2021-11-01 20:27:41 +00:00
/bin/rm "${STAGING_ROOT}/${CATEGORY_STUB}/latest-8"
ln -sr "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}" latest-8
echo "Attempting hard link"
perform_hardlink "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"
2021-11-10 23:48:10 +00:00
popd || exit