#!/bin/bash TYPE=$(echo "$1" | tr '[A-Z]' '[a-z]') OS=$(uname) ID='unknown' CODENAME='unknown' RELEASE='unknown' ARCH='unknown' # detect centos grep 'centos' /etc/issue -i -q if [ $? = '0' ]; then ID='centos' RELEASE=$(cat /etc/redhat-release | grep -o 'release [0-9]' | cut -d " " -f2) elif [ -f '/etc/redhat-release' ]; then ID='centos' RELEASE=$(cat /etc/redhat-release | grep -o 'release [0-9]' | cut -d " " -f2) # could be debian or ubuntu elif [ $(which lsb_release) ]; then ID=$(lsb_release -i | cut -f2) CODENAME=$(lsb_release -c | cut -f2) RELEASE=$(lsb_release -r | cut -f2) elif [ -f '/etc/lsb-release' ]; then ID=$(cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2) CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d "=" -f2) RELEASE=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2) elif [ -f '/etc/issue' ]; then ID=$(head -1 /etc/issue | cut -d " " -f1) if [ -f '/etc/debian_version' ]; then RELEASE=$(