Browse Source

Updated distro detection

pull/1936/head
Daniel Gibbs 7 years ago
parent
commit
a62d075d1f
  1. 27
      lgsm/functions/info_distro.sh

27
lgsm/functions/info_distro.sh

@ -13,23 +13,26 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Returns architecture, kernel and distro/os. # Returns architecture, kernel and distro/os.
arch=$(uname -m) arch=$(uname -m)
kernel=$(uname -r) kernel=$(uname -r)
if [ -n "$(command -v lsb_release)" ]; then
distroname=$(lsb_release -s -d) # Distro name - Ubuntu 16.04
elif [ -f "/etc/os-release" ]; then # Distro Version - 16.04
# Distro ID - ubuntu
if [ -f "/etc/os-release" ]; then
distroname=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g' | tr -d '="') distroname=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g' | tr -d '="')
distroversion=$(grep VERSION_ID /etc/os-release | sed 's/VERSION_ID=//g' | sed 's/\"//g')
distroid=$(grep ID /etc/os-release | grep -v _ID | grep -v ID_ | sed 's/ID=//g')
if [ -n "$(command -v lsb_release)" ]; then
distroname="$(lsb_release -sd)"
distroversion="$(lsb_release -sr)"
distroid=$(lsb_release -sc)
elif [ -f "/etc/debian_version" ]; then elif [ -f "/etc/debian_version" ]; then
distroname="Debian $(cat /etc/debian_version)" distroname="Debian $(cat /etc/debian_version)"
distroversion="$(cat /etc/debian_version)"
distroid="debian"
elif [ -f "/etc/redhat-release" ]; then elif [ -f "/etc/redhat-release" ]; then
distroname=$(cat /etc/redhat-release) distroname=$(cat /etc/redhat-release)
else distroversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|fedora" | cut -d"-" -f3)
distroname="$(uname -s) $(uname -r)" distroid="$(wk '{print $1;}' /etc/redhat-release)"
fi
if [ -f "/etc/os-release" ]; then
distroversion=$(grep VERSION_ID /etc/os-release | sed 's/VERSION_ID=//g' | sed 's/\"//g')
distroid=$(grep ID /etc/os-release | grep -v _ID | grep -v ID_ | sed 's/ID=//g')
elif [ -n "$(command -v yum)" ]; then
distroversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)
fi fi
## Glibc version ## Glibc version

Loading…
Cancel
Save