Skip to content

Commit

Permalink
fix: rename user-defined repo filename and improve parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
some-things committed Aug 21, 2024
1 parent c37a61f commit 8cb5c52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions bundles/redhat8.6/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ if [[ -n "${KUBERNETES_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},kubernetes"
fi

if [[ -f /etc/yum.repos.d/user-repos.repo ]]; then
USER_REPOS="$(awk -F '[][]' '/^\[.*\]/ {print $2}' /etc/yum.repos.d/user-repos.repo | paste -sd, -)"
if [[ -n "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},${USER_REPOS}"
elif [[ -z "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
ENABLED_REPOS="${USER_REPOS}"
if [[ -f /etc/yum.repos.d/additional-repos.repo ]]; then
ADDITIONAL_REPOS="$(/usr/libexec/platform-python3.6 -c "import configparser; config = configparser.ConfigParser(); config.read('/etc/yum.repos.d/additional-repos.repo'); print(','.join(config.sections()) if config.sections() else '')")"
if [[ -n "${ENABLED_REPOS}" ]] && [[ -n "${ADDITIONAL_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},${ADDITIONAL_REPOS}"
elif [[ -z "${ENABLED_REPOS}" ]] && [[ -n "${ADDITIONAL_REPOS}" ]]; then
ENABLED_REPOS="${ADDITIONAL_REPOS}"
fi
fi

Expand Down
12 changes: 6 additions & 6 deletions bundles/redhat8.8/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ if [[ -n "${KUBERNETES_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},kubernetes"
fi

if [[ -f /etc/yum.repos.d/user-repos.repo ]]; then
USER_REPOS="$(awk -F '[][]' '/^\[.*\]/ {print $2}' /etc/yum.repos.d/user-repos.repo | paste -sd, -)"
if [[ -n "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},${USER_REPOS}"
elif [[ -z "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
ENABLED_REPOS="${USER_REPOS}"
if [[ -f /etc/yum.repos.d/additional-repos.repo ]]; then
ADDITIONAL_REPOS="$(/usr/libexec/platform-python3.6 -c "import configparser; config = configparser.ConfigParser(); config.read('/etc/yum.repos.d/additional-repos.repo'); print(','.join(config.sections()) if config.sections() else '')")"
if [[ -n "${ENABLED_REPOS}" ]] && [[ -n "${ADDITIONAL_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},${ADDITIONAL_REPOS}"
elif [[ -z "${ENABLED_REPOS}" ]] && [[ -n "${ADDITIONAL_REPOS}" ]]; then
ENABLED_REPOS="${ADDITIONAL_REPOS}"
fi
fi

Expand Down

0 comments on commit 8cb5c52

Please sign in to comment.