Commit d23252b9 authored by Marco Clemencic's avatar Marco Clemencic Committed by Ben Couturier
Browse files

Prefer /etc/os-release to detect OS name-version

parent d52e98a8
......@@ -8,6 +8,36 @@ variables:
RPM_REPO_EOS: /eos/project/l/lhcbwebsites/www/lhcb-rpm/${RPM_REPO}
RPM_REPO_URL: "http://lhcb-rpm.web.cern.ch/lhcb-rpm/${RPM_REPO}/"
test-host_os-centos7:
stage: test
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- set -x
- test "$(./data/bin/host_os)" = "x86_64-centos7"
test-host_os-slc6:
stage: test
image: gitlab-registry.cern.ch/linuxsupport/slc6-base
script:
- set -x
- test "$(./data/bin/host_os)" = "x86_64-slc6"
test-host_os-slc5:
stage: test
image: gitlab-registry.cern.ch/linuxsupport/slc5-base
script:
- set -x
- test "$(./data/bin/host_os)" = "x86_64-slc5"
test-host_os-opensuse-leap:
stage: test
image: opensuse/leap
script:
- set -x
- test "$(./data/bin/host_os)" = "x86_64-centos7"
pack-rpm:
stage: package
#only: [tags]
......
#!/bin/bash
###############################################################################
# (c) Copyright 2018 CERN #
# (c) Copyright 2018-2019 CERN #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "LICENSE". #
......@@ -10,7 +10,10 @@
# or submit itself to any jurisdiction. #
###############################################################################
if [ -e /etc/redhat-release ] ; 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
......@@ -22,4 +25,9 @@ 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
# known compatibilities
case "${_os}" in
scientific7*|rhel7*|opensuse15*) _os=centos7 ;;
esac
echo $(uname -m)-${_os}
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