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.
|
2021-07-06 19:24:29 +00:00
|
|
|
# Source common variables
|
2021-07-06 20:33:22 +00:00
|
|
|
# shellcheck disable=SC2046,1091,1090
|
2021-07-06 21:34:26 +00:00
|
|
|
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
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
# Return back to where we started
|
2021-11-11 00:01:31 +00:00
|
|
|
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
|
|
|
|
2021-07-12 06:58:08 +00:00
|
|
|
# sync all sig stuff
|
2021-11-23 15:40:26 +00:00
|
|
|
# Only enabled for giving preferential treatment.
|
|
|
|
for SIG in "${!SIG_COMPOSE[@]}"; do
|
|
|
|
echo "${SIG}: Syncing"
|
|
|
|
cd "/mnt/compose/${MAJ}/latest-${SIG}-${MAJ}/compose" || { echo "${COMPOSE}: Failed to change directory"; break; }
|
|
|
|
|
|
|
|
TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${SIG_COMPOSE[$SIG]}"
|
|
|
|
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}"
|
|
|
|
done
|
2021-07-12 06:58:08 +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-07-12 06:58:08 +00:00
|
|
|
# copy around the ISOs a bit, make things comfortable
|
|
|
|
for ARCH in "${ARCHES[@]}"; do
|
|
|
|
TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/isos/${ARCH}"
|
2021-11-10 19:26:09 +00:00
|
|
|
# who knows if EL10 will change the name of baseos
|
2021-07-12 06:58:08 +00:00
|
|
|
for x in BaseOS Minimal; do
|
2021-11-10 19:26:09 +00:00
|
|
|
echo "${x} ${ARCH}: Copying ISO images"
|
|
|
|
# Hardcoding this for now
|
|
|
|
SOURCE="/mnt/compose/${MAJ}/latest-Rocky-${MAJ}/compose/${x}/${ARCH}/iso"
|
|
|
|
TARGET_ARCH="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/${x}/${ARCH}/iso"
|
2022-05-21 07:10:37 +00:00
|
|
|
mkdir -p "${TARGET}"
|
|
|
|
#mkdir -p "${SOURCE}" "${TARGET}" "${TARGET_ARCH}"
|
2021-11-10 19:26:09 +00:00
|
|
|
# Copy the ISO and manifests into their target architecture
|
2022-05-21 07:10:37 +00:00
|
|
|
#cp -n "${SOURCE}"/*.iso "${TARGET_ARCH}/"
|
|
|
|
#cp -n "${SOURCE}"/*.iso.manifest "${TARGET_ARCH}/"
|
|
|
|
#cp -n "${SOURCE}/CHECKSUM" "${TARGET_ARCH}/"
|
2021-11-10 19:26:09 +00:00
|
|
|
# Copy the ISO and manifests into the main isos target
|
2021-11-10 23:23:13 +00:00
|
|
|
cp "${SOURCE}"/*.iso "${TARGET}/"
|
|
|
|
cp "${SOURCE}"/*.iso.manifest "${TARGET}/"
|
2021-11-11 15:25:36 +00:00
|
|
|
pushd "${TARGET}" || { echo "Could not change directory"; break; }
|
2021-07-12 06:58:08 +00:00
|
|
|
done
|
2021-11-12 01:24:37 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
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; }
|
2021-07-12 06:58:08 +00:00
|
|
|
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}"
|
2021-11-10 23:30:20 +00:00
|
|
|
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
|