distro script: Replaced outdated method of detecting OpenSUSE version

Replaced the crude parsing of /etc/SuSE-release (which is due to be removed in
future OpenSUSE versions) with equally crude parsing of /etc/os-release.
/etc/os-release is present on several different distributions and usually
contains the same information as /etc/lsb-release when both files are
available.
For now, parsing /etc/lsb-release takes precedence and /etc/os-release is only
used as a fallback when the former is not available.
This commit is contained in:
Nils Steinger
2015-09-24 01:05:59 +02:00
parent d1d3383793
commit 506c61b7fc

View File

@@ -27,9 +27,6 @@ elif [ "${OS}" = "Linux" ] ; then
PSEUDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/SuSE-release ] ; then
DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
elif [ -f /etc/mandrake-release ] ; then
DIST='Mandrake'
PSEUDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
@@ -52,6 +49,9 @@ elif [ "${OS}" = "Linux" ] ; then
DIST=$LSB_DIST
REV=$LSB_REV
fi
elif [ -f /etc/os-release ] ; then
DIST="$(grep '^NAME=' /etc/os-release | cut -d= -f2- | tr -d '\"')"
REV="$(grep '^VERSION_ID=' /etc/os-release | cut -d= -f2- | tr -d '\"')"
fi
if [ -n "${REV}" ]