Skip to content

Commit

Permalink
Define REPOFILE & REPOFILE_OPT_PREFIX just before running prepare script
Browse files Browse the repository at this point in the history
because they're needed only there
  • Loading branch information
jpopelka committed Jan 29, 2024
1 parent c236d02 commit 73ad51b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
15 changes: 7 additions & 8 deletions mtps-prepare-system
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ EOF
: "${FIXREPO:=}"
: "${PFILE:=}"

declare -a OPTREPOS
OPTREPOS=()

# shellcheck disable=SC2034
REPOFILE="/etc/yum.repos.d/mini-tps.repo"
# shellcheck disable=SC2034
REPOFILE_OPT_PREFIX="mini-tps-opt"
declare -a OPTREPOS=()

if ! [ -d "${PROFILES_TOPDIR:=$(rpm --eval %_datarootdir)/mini-tps/profiles/}" ]; then
debug "Use dir for profiles: ${PROFILES_TOPDIR:="$PWD/profiles/"}"
debug "Profiles dir: ${PROFILES_TOPDIR:="$PWD/profiles/"}"
fi

#opt_str="$@"
Expand Down Expand Up @@ -151,6 +145,11 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi

# shellcheck disable=SC2034
REPOFILE="/etc/yum.repos.d/profile.repo"
# shellcheck disable=SC2034
REPOFILE_OPT_PREFIX="mini-tps-opt"

debug "Running prepare script: ${PREPARE_SYSTEM_SCRIPT:=$(rpm --eval %_libexecdir)/mini-tps/${OS_ID}/prepare-system}"
# shellcheck disable=SC1090
source "$PREPARE_SYSTEM_SCRIPT"
2 changes: 1 addition & 1 deletion profiles/centos-stream/prepare-system
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [ -n "$FIXREPO" ]; then
echo "Ignoring \"--fixrepo\" option as it has no effect on CentOS Stream profiles"
fi

# Replace system repositories with mini-tps repositories
# Replace system repositories with a profile repo
find "/etc/yum.repos.d/" -name "*.repo" -delete
cp -f "$PFILE" "$REPOFILE"

Expand Down
3 changes: 1 addition & 2 deletions profiles/rhel/prepare-system
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ fi

echo "Setting up RHEL internal YUM repos for selected profile"
find "/etc/yum.repos.d/" -name "${REPOFILE_OPT_PREFIX}*.repo" -exec rm --verbose -f '{}' ';'
declare -a INSTALLED_REPO_FILES=()
declare -a INSTALLED_REPO_FILES=("$REPOFILE")
cp -f "$PFILE" "$REPOFILE"
INSTALLED_REPO_FILES+=("$REPOFILE")
if [ ${#OPTREPOS[@]} -ne 0 ]; then
declare -i optindex=0
for opt in "${OPTREPOS[@]}"; do
Expand Down

0 comments on commit 73ad51b

Please sign in to comment.