diff options
-rwxr-xr-x | bin/build-rpm-package | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/build-rpm-package b/bin/build-rpm-package index 4d8676c..1db9c77 100755 --- a/bin/build-rpm-package +++ b/bin/build-rpm-package @@ -335,8 +335,22 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET done < "/etc/mock/${CUSTOM_REPO}" typeset -i REPO_START=0 + TMP_REGEX='^[[:space:]]*config_opts\['"'"'yum\.conf'"'"'\][[:space:]]*=[[:space:]]*"""[[:space:]]*$' + typeset TMP_REGEX_END='^[[:space:]]*"""[[:space:]]*$' + while read line; do + if [[ "${line}" =~ ${TMP_REGEX} ]]; then + REPO_START=1 + elif [ "${REPO_START}" -eq "1" ] && [[ "${line}" =~ ${TMP_REGEX_END} ]]; then + # Time to insert whatever is required. + elif [ "${REPO_START}" -eq "0" ] && [[ "${line}" =~ ${TMP_REGEX_END} ]]; then + echo "Error: Parsing mock base config file failed: unexpected end of yum configuration, no start found." >&2 + exit -1 + elif [ "${REPO_START}" -eq "0" ]; then + # Write-through. + echo "${line}" >> "${TMP_MOCK_CFG_FILE}" + fi done < "/etc/mock/${MOCK_BASE}" } |