From dedfdb5bd0641af562e92bce476e60ebcc46de73 Mon Sep 17 00:00:00 2001 From: Kolan Date: Tue, 8 May 2012 15:42:00 +0400 Subject: [PATCH] Distribution detection for Ubuntu --- sbin/snail.configure | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sbin/snail.configure b/sbin/snail.configure index a5f8128..7d330a8 100755 --- a/sbin/snail.configure +++ b/sbin/snail.configure @@ -38,7 +38,12 @@ DISTRIB_ID= DISTRIB_DESCRIPTION= DISTRIB_RELEASE= DISTRIB_CODENAME= -if [ -f /etc/gentoo-release ]; then +if [ -f /etc/lsb-release ]; then + DISTRIB_ID=`grep ^DISTRIB_ID /etc/lsb-release | cut -d= -f2` + DISTRIB_RELEASE=`grep ^DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2` + DISTRIB_CODENAME=`grep ^DISTRIB_CODENAME /etc/lsb-release | cut -d= -f2` + DISTRIB_DESCRIPTION=`grep ^DISTRIB_DESCRIPTION /etc/lsb-release | cut -d= -f2` +elif [ -f /etc/gentoo-release ]; then DISTRIB_ID=gentoo DISTRIB_DESCRIPTION=`cat /etc/gentoo-release` DISTRIB_RELEASE=${DISTRIB_DESCRIPTION##* } @@ -74,6 +79,9 @@ elif [ -f /etc/fedora-release ]; then DISTRIB_RELEASE=${DISTRIB_RELEASE##* } DISTRIB_CODENAME=${DISTRIB_DESCRIPTION##*\(} DISTRIB_CODENAME=${DISTRIB_CODENAME%%\)*} +elif [ -f /etc/issue ]; then + DISTRIB_ID=`cut -d" " -f1 /etc/issue | head -n1` + DISTRIB_RELEASE=`cut -d" " -f2 /etc/issue | head -n1` else DISTRIB_DESCRIPTION=`cat /etc/*release* | head -n1` DISTRIB_ID=`echo ${DISTRIB_DESCRIPTION%% *} | tr 'A-Z' 'a-z'`