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

108 lines
3.6 KiB
Bash
Raw 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}
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"
2021-11-10 23:57:42 +00:00
pushd "/mnt/compose/${MAJ}/latest-${COMPOSE}-${MAJ}/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; }
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}" \
"$(stat -c %s ${file})" \
"$(sha256sum --tag ${file})" \
| sudo tee -a CHECKSUM;
done
popd || { echo "Could not change directory"; break; }
done
fi
2021-07-12 06:58:08 +00:00
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}"
2021-11-10 23:56:31 +00:00
2022-11-10 18:56:09 +00:00
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}"
fi
2021-11-10 23:56:31 +00:00
# Return back to where we started
2021-11-11 00:01:31 +00:00
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; }
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
for LINK in "${LINK_REPOS[@]}"; do
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"
2021-08-02 23:03:51 +00:00
cp -na "${SOURCE}" "${TARGET}"
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
2021-11-10 23:48:10 +00:00
popd || exit