Commit 6f545fe1 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Allow overriding of host_os detection

on unknown platforms one can set `force_host_os` to pretend to be on a
supported one
parent c5ab606f
Pipeline #838562 passed with stages
in 1 minute and 16 seconds
......@@ -10,21 +10,27 @@
# or submit itself to any jurisdiction. #
###############################################################################
_os=unknown
if [ -e /etc/os-release ] ; then
_os=$(awk -F= '/^ID=/{gsub("[.\"]|(-.*)", "", $2); n=tolower($2)}/^VERSION_ID/{gsub("[.\"]", "", $2); v=$2}END{print n""v}' /etc/os-release)
elif [ -e /etc/redhat-release ] ; then
if grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 7' /etc/redhat-release ; then
_os=centos7
elif grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 6' /etc/redhat-release ; then
_os=slc6
elif grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 5' /etc/redhat-release ; then
_os=slc5
if [ -z "${force_host_os}" ] ; then
_os=unknown
if [ -e /etc/os-release ] ; then
_os=$(awk -F= '/^ID=/{gsub("[.\"]|(-.*)", "", $2); n=tolower($2)}/^VERSION_ID/{gsub("[.\"]", "", $2); v=$2}END{print n""v}' /etc/os-release)
elif [ -e /etc/redhat-release ] ; then
if grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 7' /etc/redhat-release ; then
_os=centos7
elif grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 6' /etc/redhat-release ; then
_os=slc6
elif grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 5' /etc/redhat-release ; then
_os=slc5
fi
elif [ -e /etc/lsb-release ] ; then
_os=$(awk -F= '/^DISTRIB_ID/{n=tolower($2)}/^DISTRIB_RELEASE/{gsub("\\.", "", $2); v=$2}END{print n""v}' /etc/lsb-release)
fi
elif [ -e /etc/lsb-release ] ; then
_os=$(awk -F= '/^DISTRIB_ID/{n=tolower($2)}/^DISTRIB_RELEASE/{gsub("\\.", "", $2); v=$2}END{print n""v}' /etc/lsb-release)
else
(>&2 echo "warning: overriding host os detection (using ${force_host_os})")
_os=${force_host_os}
fi
# known compatibilities
case "${_os}" in
scientific7*|rhel7*|opensuse15*) _os=centos7 ;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment