diff --git a/schutzbot/mockbuild.sh b/schutzbot/mockbuild.sh index 0a0c9a02..cc04bb3b 100755 --- a/schutzbot/mockbuild.sh +++ b/schutzbot/mockbuild.sh @@ -10,6 +10,14 @@ function greenprint { source /etc/os-release ARCH=$(uname -m) +# Register RHEL if we are provided with a registration script and intend to do that. +REGISTER="${REGISTER:-'false'}" +if [[ $REGISTER == "true" && -n "${RHN_REGISTRATION_SCRIPT:-}" ]] && ! sudo subscription-manager status; then + greenprint "🪙 Registering RHEL instance" + sudo chmod +x "$RHN_REGISTRATION_SCRIPT" + sudo "$RHN_REGISTRATION_SCRIPT" +fi + # Mock configuration file to use for building RPMs. MOCK_CONFIG="${ID}-${VERSION_ID%.*}-$(uname -m)" @@ -50,14 +58,6 @@ if [[ $ID == rhel || $ID == centos ]] && ! rpm -q epel-release; then sudo rpm -Uvh /tmp/epel.rpm fi -# Register RHEL if we are provided with a registration script and intend to do that. -REGISTER="${REGISTER:-'false'}" -if [[ $REGISTER == "true" && -n "${RHN_REGISTRATION_SCRIPT:-}" ]] && ! sudo subscription-manager status; then - greenprint "🪙 Registering RHEL instance" - sudo chmod +x "$RHN_REGISTRATION_SCRIPT" - sudo "$RHN_REGISTRATION_SCRIPT" -fi - # Install requirements for building RPMs in mock. greenprint "📦 Installing mock requirements" sudo dnf -y install createrepo_c make mock python3-pip rpm-build s3cmd