in theory finish os_version

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-04-05 00:10:26 +02:00
parent b474960774
commit edfedc5c06
1 changed files with 16 additions and 57 deletions

View File

@ -27,66 +27,25 @@ case "$($__explorer/os)" in
# empty, but well...
cat /etc/arch-release
;;
macosx|openbsd)
debian)
cat /etc/debian_version
;;
fedora)
cat /etc/fedora-release
;;
gentoo)
cat /etc/gentoo-release
;;
macosx|*bsd|solaris)
uname -r
;;
esac
exit 0
# Ubuntu is also Debian, thus return if Ubuntu was found
if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
echo ubuntu
exit 0
fi
if [ -f /etc/debian_version ]; then
echo debian
exit 0
fi
if [ -f /etc/gentoo-release ]; then
echo gentoo
exit 0
fi
# Fedora is also Redhat, thus return before redhat!
if grep -q ^Fedora /etc/redhat-release 2>/dev/null; then
echo fedora
exit 0
fi
if [ -f /etc/redhat-release ]; then
echo redhat
exit 0
fi
if [ -f /etc/SuSE-release ]; then
echo suse
exit 0
fi
uname_s="$(uname -s)"
# Assume there is no tr on the client -> do lower case ourselves
case "$uname_s" in
NetBSD)
echo netbsd
exit 0
redhat)
cat /etc/redhat-release
;;
FreeBSD)
echo freebsd
exit 0
suse)
cat /etc/SuSE-release
;;
OpenBSD)
echo openbsd
exit 0
;;
SunOS)
echo solaris
exit 0
ubuntu)
lsb_release -sr
;;
esac
echo "Unknown OS" >&2
exit 1