diff --git a/schutzbot/mockbuild.sh b/schutzbot/mockbuild.sh index c2738b6a..b7824ab2 100755 --- a/schutzbot/mockbuild.sh +++ b/schutzbot/mockbuild.sh @@ -37,8 +37,7 @@ function template_override { } # Get OS and architecture details. -source /etc/os-release -ARCH=$(uname -m) +source tools/set-env-variables.sh # Register RHEL if we are provided with a registration script and intend to do that. REGISTER="${REGISTER:-'false'}" diff --git a/tools/set-env-variables.sh b/tools/set-env-variables.sh new file mode 100644 index 00000000..50f8a240 --- /dev/null +++ b/tools/set-env-variables.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# don't error on unused ARCH and DISTRO_CODE variables +# shellcheck disable=SC2034 + +source /etc/os-release +ARCH=$(uname -m) +DISTRO_CODE="${DISTRO_CODE:-${ID}-${VERSION_ID//./}}"