2021-07-05 06:50:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# This should only be ran during straight updates during a minor release cadence.
|
|
|
|
# In the case of point releases, this will need to be changed accordingly so that
|
|
|
|
# way it can be ran properly.
|
|
|
|
#
|
|
|
|
# The point of this script is to basically allow all old versions of a package
|
|
|
|
# or set of packages to be available during the life of a point release. As it
|
|
|
|
# currently stands, CentOS has started doing this for both 8 and 8-stream. RHEL
|
|
|
|
# also does this (and has always done this, except they take it a step further
|
|
|
|
# and provide everything, even if it's not installable).
|
|
|
|
#
|
|
|
|
# Compose dir example: /mnt/repos-staging/mirror/pub/rocky/8.4-RC2
|
|
|
|
|
2021-07-06 17:08:30 +00:00
|
|
|
# Source common variables
|
2021-07-08 02:54:12 +00:00
|
|
|
export RLVER=8
|
2021-07-08 02:58:50 +00:00
|
|
|
# shellcheck disable=SC2046,1091,1090
|
2021-07-06 21:34:26 +00:00
|
|
|
source "$(dirname "$0")/common"
|
2021-07-05 06:50:25 +00:00
|
|
|
|
|
|
|
echo "** Updating source repos"
|
2021-07-06 17:08:30 +00:00
|
|
|
for y in "${ALL_REPOS[@]}"; do
|
2021-07-06 23:11:25 +00:00
|
|
|
test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree"
|
2021-07-05 06:50:25 +00:00
|
|
|
ret_val=$?
|
|
|
|
if [ "$ret_val" -eq 0 ]; then
|
2021-12-20 01:21:38 +00:00
|
|
|
createrepo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree" \
|
|
|
|
"--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \
|
2023-02-08 19:11:00 +00:00
|
|
|
--workers 12
|
2021-08-05 16:57:37 +00:00
|
|
|
sed -i '/<open-size><\/open-size>/d' \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree/repodata/repomd.xml"
|
2021-09-14 15:40:59 +00:00
|
|
|
test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree/repodata/repomd.xml"
|
2021-07-05 06:50:25 +00:00
|
|
|
else
|
2021-07-06 17:08:30 +00:00
|
|
|
echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree does not exist"
|
2021-07-05 06:50:25 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Sync up some stuff
|
|
|
|
echo "** Updating arch repos as necessary **"
|
|
|
|
for x in "${ARCHES[@]}"; do
|
|
|
|
echo "${x}: Sync up repos that do not use comps/groups"
|
|
|
|
# regular repos, no comps
|
|
|
|
for y in "${NONMODS_REPOS[@]}"; do
|
|
|
|
# os and debug/tree directories
|
2021-09-14 15:40:59 +00:00
|
|
|
for z in os debug/tree kickstart; do
|
2021-07-06 17:08:30 +00:00
|
|
|
test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}"
|
2021-07-05 06:50:25 +00:00
|
|
|
ret_val=$?
|
|
|
|
if [ "$ret_val" -eq 0 ]; then
|
2022-05-26 04:39:26 +00:00
|
|
|
createrepo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}" \
|
2021-12-20 01:21:38 +00:00
|
|
|
"--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \
|
2023-02-08 19:11:00 +00:00
|
|
|
--workers 12
|
2021-08-05 16:57:37 +00:00
|
|
|
sed -i '/<open-size><\/open-size>/d' \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}/repodata/repomd.xml"
|
2021-09-14 15:40:59 +00:00
|
|
|
test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}/repodata/repomd.xml"
|
2021-07-05 06:50:25 +00:00
|
|
|
else
|
2021-07-06 17:08:30 +00:00
|
|
|
echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z} does not exist"
|
2021-07-05 06:50:25 +00:00
|
|
|
fi
|
|
|
|
done
|
2021-07-05 11:09:47 +00:00
|
|
|
done
|
2021-07-05 06:50:25 +00:00
|
|
|
# repos with comps/groups involved, but only debug
|
|
|
|
for y in "${MODS_REPOS[@]}"; do
|
2021-07-06 17:08:30 +00:00
|
|
|
test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree"
|
2021-07-05 06:50:25 +00:00
|
|
|
ret_val=$?
|
|
|
|
if [ "$ret_val" -eq 0 ]; then
|
2021-07-10 23:09:34 +00:00
|
|
|
createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree" \
|
2021-12-20 01:21:38 +00:00
|
|
|
"--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \
|
2023-02-08 19:11:00 +00:00
|
|
|
--workers 12 --retain-old-md-by-age 1d
|
2021-08-05 16:57:37 +00:00
|
|
|
sed -i '/<open-size><\/open-size>/d' \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree/repodata/repomd.xml"
|
2021-09-14 15:40:59 +00:00
|
|
|
test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree/repodata/repomd.xml"
|
2021-07-05 06:50:25 +00:00
|
|
|
else
|
2021-07-06 17:08:30 +00:00
|
|
|
echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree does not exist"
|
2021-07-05 06:50:25 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "** Update all repos with comps/groups"
|
|
|
|
for y in "${MODS_REPOS[@]}"; do
|
|
|
|
echo "${y}: ${x}"
|
2021-07-06 17:08:30 +00:00
|
|
|
test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os"
|
2021-07-05 06:50:25 +00:00
|
|
|
ret_val=$?
|
|
|
|
if [ "$ret_val" -eq 0 ]; then
|
2021-07-06 17:08:30 +00:00
|
|
|
createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os" \
|
2021-07-05 06:50:25 +00:00
|
|
|
--groupfile="/mnt/compose/8/latest-Rocky-8/work/${x}/comps/comps-${y}.${x}.xml" \
|
2021-07-06 20:16:01 +00:00
|
|
|
--xz --revision="${REVISION}" \
|
2021-07-05 06:50:25 +00:00
|
|
|
"--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \
|
2023-02-08 19:11:00 +00:00
|
|
|
--workers=12 --checksum=sha256 --retain-old-md-by-age 1d
|
2021-09-14 15:40:59 +00:00
|
|
|
sed -i '/<open-size><\/open-size>/d' \
|
2021-07-11 22:46:50 +00:00
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
|
2021-08-05 16:57:37 +00:00
|
|
|
sed -i '/<open-size><\/open-size>/d' \
|
2021-09-14 15:40:59 +00:00
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/kickstart/repodata/repomd.xml"
|
|
|
|
test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
|
2021-08-05 16:57:37 +00:00
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
|
2021-07-05 06:50:25 +00:00
|
|
|
else
|
2021-07-06 17:08:30 +00:00
|
|
|
echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os does not exist"
|
2021-07-05 06:50:25 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "** Update modules"
|
|
|
|
for y in "${MODS[@]}"; do
|
|
|
|
echo "Modules: ${y} ${x}"
|
|
|
|
cp "/mnt/compose/8_metadata/${x}/${y}-modules.yaml" /tmp/modules.yaml
|
2021-07-06 17:08:30 +00:00
|
|
|
test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os"
|
2021-07-05 10:43:58 +00:00
|
|
|
ret_val=$?
|
|
|
|
if [ "$ret_val" -eq 0 ]; then
|
|
|
|
modifyrepo --mdtype=modules /tmp/modules.yaml \
|
2021-07-06 17:08:30 +00:00
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata" \
|
2021-07-27 19:22:02 +00:00
|
|
|
--compress --compress-type=xz
|
2021-07-11 22:46:50 +00:00
|
|
|
# This might not be necessary, but it does not hurt incase repomd is modified
|
2021-08-05 16:57:37 +00:00
|
|
|
sed -i '/<open-size><\/open-size>/d' \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
|
2021-09-14 15:40:59 +00:00
|
|
|
test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \
|
|
|
|
"${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml"
|
2021-07-05 10:43:58 +00:00
|
|
|
else
|
2021-07-06 17:08:30 +00:00
|
|
|
echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os does not exist"
|
2021-07-05 10:43:58 +00:00
|
|
|
fi
|
2021-07-05 06:50:25 +00:00
|
|
|
|
|
|
|
rm /tmp/modules.yaml
|
|
|
|
sleep 1
|
|
|
|
done
|
2021-07-06 02:59:39 +00:00
|
|
|
|
|
|
|
echo "** Fix variants"
|
2021-07-12 07:50:40 +00:00
|
|
|
treeinfoFixer "${x}"
|
2021-07-05 06:50:25 +00:00
|
|
|
done
|