host_os 1.38 KB
Newer Older
Marco Clemencic's avatar
Marco Clemencic committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
###############################################################################
# (c) Copyright 2018 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".   #
#                                                                             #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization  #
# or submit itself to any jurisdiction.                                       #
###############################################################################

if [ -e /etc/redhat-release ] ; then
14
  if grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 7' /etc/redhat-release ; then
Marco Clemencic's avatar
Marco Clemencic committed
15
    _os=centos7
16
  elif grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 6' /etc/redhat-release ; then
Marco Clemencic's avatar
Marco Clemencic committed
17
    _os=slc6
18
  elif grep -q -E '(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 5' /etc/redhat-release ; then
Marco Clemencic's avatar
Marco Clemencic committed
19
20
21
22
23
24
25
    _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

echo $(uname -m)-${_os}