From 2f1b83bbaefdfd99a5cb1938cc1ffc656a1c8131 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Wed, 23 Sep 2015 00:03:15 +0200 Subject: [PATCH 1/4] distro script: Added Arch Linux detection --- scripts/distro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/distro b/scripts/distro index 922960d2b..338210499 100755 --- a/scripts/distro +++ b/scripts/distro @@ -40,6 +40,9 @@ elif [ "${OS}" = "Linux" ] ; then elif [ -f /etc/gentoo-release ] ; then DIST="Gentoo" REV=$(tr -d '[[:alpha:]]' Date: Wed, 23 Sep 2015 00:04:06 +0200 Subject: [PATCH 2/4] distro script: Handle cases where a distribution's version string is empty --- scripts/distro | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/distro b/scripts/distro index 338210499..953f39429 100755 --- a/scripts/distro +++ b/scripts/distro @@ -59,7 +59,13 @@ elif [ "${OS}" = "Linux" ] ; then fi # OSSTR="${OS} ${DIST} ${REV}(${PSEUDONAME} ${KERNEL} ${MACH})" - OSSTR="${DIST} ${REV}" + if [ -n "${REV}" ] + then + OSSTR="${DIST} ${REV}" + else + OSSTR="${DIST}" + fi + elif [ "${OS}" = "Darwin" ] ; then if [ -f /usr/bin/sw_vers ] ; then OSSTR=`/usr/bin/sw_vers|grep -v Build|sed 's/^.*:.//'| tr "\n" ' '` From 774312d4572f3bcbb693c9b4d30a828aacd2ff15 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Wed, 23 Sep 2015 00:05:16 +0200 Subject: [PATCH 3/4] distro script: Code cleanup --- scripts/distro | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/distro b/scripts/distro index 953f39429..ed28eb6f6 100755 --- a/scripts/distro +++ b/scripts/distro @@ -43,9 +43,7 @@ elif [ "${OS}" = "Linux" ] ; then elif [ -f /etc/arch-release ] ; then DIST="Arch Linux" REV="" # Omit version since Arch Linux uses rolling releases - fi - - if [ -f /etc/UnitedLinux-release ] ; then + elif [ -f /etc/UnitedLinux-release ] ; then DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" fi @@ -58,7 +56,6 @@ elif [ "${OS}" = "Linux" ] ; then fi fi -# OSSTR="${OS} ${DIST} ${REV}(${PSEUDONAME} ${KERNEL} ${MACH})" if [ -n "${REV}" ] then OSSTR="${DIST} ${REV}" From d048e5e616a3d50efbc1c41d2fdd926c08dd2ad2 Mon Sep 17 00:00:00 2001 From: Nils Steinger Date: Wed, 23 Sep 2015 00:06:41 +0200 Subject: [PATCH 4/4] distro script: Only parse /etc/lsb-release if no known distribution is found --- scripts/distro | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/distro b/scripts/distro index ed28eb6f6..6655ad47a 100755 --- a/scripts/distro +++ b/scripts/distro @@ -45,9 +45,7 @@ elif [ "${OS}" = "Linux" ] ; then REV="" # Omit version since Arch Linux uses rolling releases elif [ -f /etc/UnitedLinux-release ] ; then DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" - fi - - if [ -f /etc/lsb-release ] ; then + elif [ -f /etc/lsb-release ] ; then LSB_DIST="`cat /etc/lsb-release | grep DISTRIB_ID | cut -d "=" -f2`" LSB_REV="`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d "=" -f2`" if [ "$LSB_DIST" != "" ] ; then