From 8ec4536e4985f8ee72563f058503e4293ee63dd6 Mon Sep 17 00:00:00 2001 From: nazunalika Date: Wed, 7 Jul 2021 19:54:12 -0700 Subject: [PATCH 1/3] expand use --- sync/common | 55 ++++++++++++------------------------- sync/common_8 | 48 ++++++++++++++++++++++++++++++++ sync/prep-staging-8.sh | 1 + sync/sync-to-prod.sh | 2 +- sync/sync-to-staging-sig.sh | 14 ++++++---- sync/sync-to-staging.sh | 11 +++++--- sync/test.sh | 7 +++++ 7 files changed, 90 insertions(+), 48 deletions(-) create mode 100644 sync/common_8 create mode 100644 sync/test.sh diff --git a/sync/common b/sync/common index cd322f8..698fde5 100644 --- a/sync/common +++ b/sync/common @@ -1,51 +1,30 @@ # To be sourced by scripts to use -# Revision must always start with a major number -REVISION=8.4 - -MAJOR="${REVISION:0:1}" -MINOR="${REVISION:2:1}" - -# comment or blank if needed -APPEND_TO_DIR="-RC2" +# Temporary probably. This makes it so if RLVER=... is called before the script +# it will set the version for the variables to call up. This was easier than +# creating duplicates of a bunch of stuff. Default version is 8. +if [ -z "$RLVER" ]; then + export RLVER=8 +fi 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}" + +# should be overriden in other commons +#RELEASE_DIR="${CATEGORY_STUB}/${REVISION}${APPEND_TO_DIR}" # Define arches we support ARCHES=(x86_64 aarch64) -# 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=( - extras - Devel - nfv - storage/gluster9 - plus -) +#Source Major common +test -f "$(dirname "$0")/common_${RLVER}" && source "$(dirname "$0")/common_${RLVER}" +if [ "$?" -ne 0 ]; then + echo "Could not source common_${RLVER}" + exit 1 +fi -# These repos have comps/groups, except for debuginfo and sources -MODS_REPOS=( - BaseOS - AppStream - HighAvailability - ResilientStorage - PowerTools -) - -ALL_REPOS=( - "${NONMODS_REPOS[@]}" - "${MODS_REPOS[@]}" -) - -# These repos have modules -MODS=( - AppStream - PowerTools -) +# Combined variables based on common data +REV="${REVISION}${APPEND_TO_DIR}" diff --git a/sync/common_8 b/sync/common_8 new file mode 100644 index 0000000..c47757c --- /dev/null +++ b/sync/common_8 @@ -0,0 +1,48 @@ +# To be sourced by scripts to use + +# Revision must always start with a major number +REVISION=8.4 + +MAJOR="${REVISION:0:1}" +MINOR="${REVISION:2:1}" + +# comment or blank if needed +APPEND_TO_DIR="-RC2" + +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}" + +# 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=( + extras + Devel + nfv + storage/gluster9 + plus +) + +# These repos have comps/groups, except for debuginfo and sources +MODS_REPOS=( + BaseOS + AppStream + HighAvailability + ResilientStorage + PowerTools +) + +ALL_REPOS=( + "${NONMODS_REPOS[@]}" + "${MODS_REPOS[@]}" +) + +# These repos have modules +MODS=( + AppStream + PowerTools +) diff --git a/sync/prep-staging-8.sh b/sync/prep-staging-8.sh index bb36aaf..380d8e3 100644 --- a/sync/prep-staging-8.sh +++ b/sync/prep-staging-8.sh @@ -13,6 +13,7 @@ # Source common variables # shellcheck disable=SC2046,1091,1090 +export RLVER=8 source "$(dirname "$0")/common" echo "** Updating source repos" diff --git a/sync/sync-to-prod.sh b/sync/sync-to-prod.sh index 4edf198..ca26a59 100644 --- a/sync/sync-to-prod.sh +++ b/sync/sync-to-prod.sh @@ -5,7 +5,7 @@ # shellcheck disable=SC2046,1091,1090 source "$(dirname "$0")/common" -REV=${1} +REV=${REVISION}${APPEND_TO_DIR} cd "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}" || { echo "Failed to change directory"; ret_val=1; exit 1; } ret_val=$? diff --git a/sync/sync-to-staging-sig.sh b/sync/sync-to-staging-sig.sh index 2a25072..0be3bcc 100644 --- a/sync/sync-to-staging-sig.sh +++ b/sync/sync-to-staging-sig.sh @@ -4,14 +4,18 @@ # shellcheck disable=SC2046,1091,1090 source "$(dirname "$0")/common" +if [[ $# -eq 0 ]] || [[ $# -eq 1 ]]; then + echo "Not enough information." + echo "You must use: shortname sig" + exit 1 +fi + # Major Version (eg, 8) -MAJ=${1} +MAJ=${RLVER} # Short name (eg, NFV, extras, Rocky, gluster9) -SHORT=${2} -# The directory where we're going to, usually MAJOR.MINOR, sometimes it's MAJOR.MINOR-RCX -REV=${3} +SHORT=${1} # Note, this should be lowercase. eg, storage. -SIG=${4} +SIG=${2} cd "/mnt/compose/${MAJ}/latest-${SHORT}-${MAJ}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; } ret_val=$? diff --git a/sync/sync-to-staging.sh b/sync/sync-to-staging.sh index 3a0c068..1e764c8 100644 --- a/sync/sync-to-staging.sh +++ b/sync/sync-to-staging.sh @@ -4,12 +4,15 @@ # shellcheck disable=SC2046,1091,1090 source "$(dirname "$0")/common" +if [[ $# -eq 0 ]]; then + echo "You must specify a short name." + exit 1 +fi + # Major Version (eg, 8) -MAJ=${1} +MAJ=${RLVER} # Short name (eg, NFV, extras, Rocky, gluster9) -SHORT=${2} -# The directory where we're going to, usually MAJOR.MINOR, sometimes it's MAJOR.MINOR-RCX -REV=${3} +SHORT=${1} cd "/mnt/compose/${MAJ}/latest-${SHORT}-${MAJ}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; } ret_val=$? diff --git a/sync/test.sh b/sync/test.sh new file mode 100644 index 0000000..a41781c --- /dev/null +++ b/sync/test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# tests that the variables work +source "$(dirname "$0")/common" +echo ${RELEASE_DIR} +echo ${STAGING_ROOT}/${CATEGORY_STUB}/${REV} +echo $NONMODS_REPOS +echo ${REV} From 5d8541fc107c6f156b0b6fa3d4170b937793a636 Mon Sep 17 00:00:00 2001 From: nazunalika Date: Wed, 7 Jul 2021 19:56:55 -0700 Subject: [PATCH 2/3] fix tester --- sync/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sync/test.sh b/sync/test.sh index a41781c..81845d4 100644 --- a/sync/test.sh +++ b/sync/test.sh @@ -1,7 +1,7 @@ #!/bin/bash # tests that the variables work source "$(dirname "$0")/common" -echo ${RELEASE_DIR} -echo ${STAGING_ROOT}/${CATEGORY_STUB}/${REV} -echo $NONMODS_REPOS -echo ${REV} +echo "${RELEASE_DIR}" +echo "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}" +echo "$NONMODS_REPOS" +echo "${REV}" From 3cd78ce35986a6298a25f3789b4fde71bcc638ef Mon Sep 17 00:00:00 2001 From: nazunalika Date: Wed, 7 Jul 2021 19:58:50 -0700 Subject: [PATCH 3/3] fixes --- sync/prep-staging-8.sh | 2 +- sync/test.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sync/prep-staging-8.sh b/sync/prep-staging-8.sh index 380d8e3..90cbb7d 100644 --- a/sync/prep-staging-8.sh +++ b/sync/prep-staging-8.sh @@ -12,8 +12,8 @@ # Compose dir example: /mnt/repos-staging/mirror/pub/rocky/8.4-RC2 # Source common variables -# shellcheck disable=SC2046,1091,1090 export RLVER=8 +# shellcheck disable=SC2046,1091,1090 source "$(dirname "$0")/common" echo "** Updating source repos" diff --git a/sync/test.sh b/sync/test.sh index 81845d4..876a040 100644 --- a/sync/test.sh +++ b/sync/test.sh @@ -1,5 +1,6 @@ #!/bin/bash # tests that the variables work +# shellcheck disable=SC1090 source "$(dirname "$0")/common" echo "${RELEASE_DIR}" echo "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"