mockbuild: move registration on top of the file

we did the same in osbuild and composer
This commit is contained in:
Ondřej Budai 2021-07-23 14:26:44 +02:00 committed by Christian Kellner
parent 345265e9d2
commit 748e08d434

View file

@ -10,6 +10,13 @@ function greenprint {
source /etc/os-release
ARCH=$(uname -m)
# Register RHEL if we are provided with a registration script.
if [[ -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)"
@ -46,13 +53,6 @@ if [[ $ID == rhel ]] && ! rpm -q epel-release; then
sudo rpm -Uvh /tmp/epel.rpm
fi
# Register RHEL if we are provided with a registration script.
if [[ -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 mock s3cmd