mockbuild: register the host as soon as possible

So we can check if we are subscribed in the variable definitions.

I believe that registering the instance will go away soon nevertheless.
This commit is contained in:
Ondřej Budai 2021-07-12 12:26:24 +02:00 committed by Ondřej Budai
parent 54f233ac96
commit 41e01326f0

View file

@ -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