toolkit/sync/common_8

187 lines
5.7 KiB
Plaintext
Raw Normal View History

2021-07-08 02:54:12 +00:00
# To be sourced by scripts to use
# Revision must always start with a major number
case "${RLREL}" in
stable)
2023-11-17 09:32:37 +00:00
REVISION=8.9
2023-11-22 03:09:43 +00:00
PREREV=8.8
2023-11-19 23:16:33 +00:00
APPEND_TO_DIR="-RC2"
;;
beta)
2023-11-22 03:09:43 +00:00
REVISION=8.10
PREREV=8.9
APPEND_TO_DIR="-BETA"
2023-01-13 22:17:35 +00:00
COMPOSE_APPEND="${APPEND_TO_DIR}"
;;
lh)
2023-09-07 19:23:28 +00:00
REVISION=8.10
2023-11-22 03:09:43 +00:00
PREREV=8.9
APPEND_TO_DIR="-LookAhead"
2023-01-13 22:17:35 +00:00
COMPOSE_APPEND="${APPEND_TO_DIR}"
;;
*)
2023-05-17 07:34:33 +00:00
echo "option not recognized"
;;
esac
2021-07-08 02:54:12 +00:00
2023-01-13 22:17:35 +00:00
MAJOR="${REVISION%.*}"
MINOR="${REVISION#*.}"
2021-07-08 02:54:12 +00:00
STAGING_ROOT="/mnt/repos-staging"
PRODUCTION_ROOT="/mnt/repos-production"
# relative to ${ENV}_ROOT
CATEGORY_STUB="mirror/pub/rocky"
RELEASE_DIR="${CATEGORY_STUB}/${REVISION}${APPEND_TO_DIR}"
2023-01-13 22:32:50 +00:00
RELEASE_COMPOSE_ROOT="${COMPOSE_ROOT}/${MAJOR}${COMPOSE_APPEND}/latest-${SHORT}-${MAJOR}"
2021-07-08 02:54:12 +00:00
# Set all repos that have no comps/groups associated with them. This is even in
# cases where repos will not be available by normal means. It's just for
# consistency.
NONMODS_REPOS=(
2022-05-19 07:46:16 +00:00
extras
devel
2021-07-08 02:54:12 +00:00
plus
)
2022-05-12 07:18:34 +00:00
# These repos were originally separate from the main compose and need symlinks
2022-05-19 07:46:16 +00:00
declare -A LINK_REPOS
2022-05-12 07:18:34 +00:00
LINK_REPOS=(
[NFV]="nfv"
[Devel]="devel"
2022-05-12 07:18:34 +00:00
)
2021-07-08 02:54:12 +00:00
# These repos have comps/groups, except for debuginfo and sources
MODS_REPOS=(
BaseOS
AppStream
HighAvailability
ResilientStorage
PowerTools
2021-08-24 06:29:07 +00:00
RT
2022-05-12 07:18:34 +00:00
NFV
2021-07-08 02:54:12 +00:00
)
ALL_REPOS=(
"${NONMODS_REPOS[@]}"
"${MODS_REPOS[@]}"
)
2021-07-12 06:58:08 +00:00
NONSIG_COMPOSE=(
Rocky
2022-11-10 18:56:09 +00:00
Extras
Rocky-devel
2021-07-12 06:58:08 +00:00
)
declare -A SIG_COMPOSE
2021-11-23 15:40:26 +00:00
SIG_COMPOSE=(
[kernel]="kernel/kernel"
[kmod]="kernel/kmod"
)
2021-07-12 06:58:08 +00:00
2021-07-08 02:54:12 +00:00
# These repos have modules
2023-11-16 23:07:15 +00:00
MODS=(
2021-07-08 02:54:12 +00:00
AppStream
PowerTools
)
2021-07-12 07:50:40 +00:00
# functions
# Note, EL8 and EL9 may not be the same, do not put in 'common'
2021-11-14 05:43:11 +00:00
function treeinfoSaver() {
BaseOSArch="${1}"
TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo"
PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo-pristine"
/bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}"
}
2021-07-12 07:50:40 +00:00
function treeinfoFixer() {
BaseOSArch="${1}"
TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo"
PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo-pristine"
test -f "${PRISTINE_TREE}"
pris_retval=$?
if [ "$pris_retval" -eq 0 ]; then
/bin/cp "${PRISTINE_TREE}" "${TREEINFO_VAR}"
else
echo "WARNING: We do not have a pristine treeinfo to copy from"
fi
}
# Note, EL8 and EL9 may not be the same, do not put in 'common'
function treeinfoModder() {
BaseOSArch="${1}"
TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo"
PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/os/.treeinfo-pristine"
test -f "${TREEINFO_VAR}"
treeinfo_retval=$?
test -x /usr/bin/python3
python_retval=$?
# There is an awk way to do this, but it was easier to implement python and
# cat heredoc together. It felt cleaner. This was a trick I had used in a
# previous life when I had to admin Solaris systems, and I needed a way to
# add a solaris 10 system into FreeIPA (it was not fun, let me tell you). But
# the take away is I learned something kind of on the fly and well, it worked.
# Emails should have stamps.
if [ "$treeinfo_retval" -eq 0 ] && [ "$python_retval" -eq 0 ]; then
cat <<EOF | /usr/bin/python3
from configparser import ConfigParser
config = ConfigParser()
config.read('${TREEINFO_VAR}')
config.set('tree', 'variants', 'BaseOS,AppStream')
config.add_section('variant-AppStream')
config.set('variant-AppStream', 'id', 'AppStream')
config.set('variant-AppStream', 'name', 'AppStream')
config.set('variant-AppStream', 'type', 'variant')
config.set('variant-AppStream', 'uid', 'AppStream')
config.set('variant-AppStream', 'packages', '../../../AppStream/${BaseOSArch}/os/Packages')
config.set('variant-AppStream', 'repository', '../../../AppStream/${BaseOSArch}/os/')
with open('${TREEINFO_VAR}', 'w') as configfile:
config.write(configfile)
EOF
else
echo "${TREEINFO_VAR}, or python3 does not exist on this system."
fi
/bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}"
}
function treeinfoModderKickstart() {
BaseOSArch="${1}"
2021-11-12 02:08:06 +00:00
TREEINFO_VAR="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/kickstart/.treeinfo"
PRISTINE_TREE="${STAGING_ROOT}/${RELEASE_DIR}/BaseOS/${BaseOSArch}/kickstart/.treeinfo-pristine"
test -f "${TREEINFO_VAR}"
treeinfo_retval=$?
test -x /usr/bin/python3
python_retval=$?
# There is an awk way to do this, but it was easier to implement python and
# cat heredoc together. It felt cleaner. This was a trick I had used in a
# previous life when I had to admin Solaris systems, and I needed a way to
# add a solaris 10 system into FreeIPA (it was not fun, let me tell you). But
# the take away is I learned something kind of on the fly and well, it worked.
# Emails should have stamps.
if [ "$treeinfo_retval" -eq 0 ] && [ "$python_retval" -eq 0 ]; then
cat <<EOF | /usr/bin/python3
from configparser import ConfigParser
config = ConfigParser()
config.read('${TREEINFO_VAR}')
config.set('tree', 'variants', 'BaseOS,AppStream')
2021-11-14 18:29:09 +00:00
config.add_section('variant-AppStream')
config.set('variant-AppStream', 'id', 'AppStream')
config.set('variant-AppStream', 'name', 'AppStream')
config.set('variant-AppStream', 'type', 'variant')
config.set('variant-AppStream', 'uid', 'AppStream')
config.set('variant-AppStream', 'packages', '../../../AppStream/${BaseOSArch}/kickstart/Packages')
config.set('variant-AppStream', 'repository', '../../../AppStream/${BaseOSArch}/kickstart/')
with open('${TREEINFO_VAR}', 'w') as configfile:
config.write(configfile)
EOF
else
echo "${TREEINFO_VAR}, or python3 does not exist on this system."
fi
/bin/cp "${TREEINFO_VAR}" "${PRISTINE_TREE}"
}
2021-07-12 07:50:40 +00:00
export -f treeinfoFixer
export -f treeinfoModder
export -f treeinfoModderKickstart