wardmundy
Nerd Uno
- Joined
- Oct 12, 2007
- Messages
- 19,206
- Reaction score
- 5,228
This snippet seems to work on all non-proprietary Linux flavors and releases including RHEL, Fedora, CentOS, Scientific Linux, Oracle Linux, PIAF, Debian, Ubuntu, and Raspbian.
Haven't tested Hannah Montana yet.
Building this in preparation for a unified Incredible PBX installer in case you're wondering.
Haven't tested Hannah Montana yet.
Code:
#!/bin/bash
flavor=`head -n 1 /etc/issue | cut -f 1 -d " "`
release=`head -n 1 /etc/issue | grep "\n" | cut -f 3 -d " "`
if [ "$release" = "release" ]; then
release=`head -n 1 /etc/issue | grep "\n" | cut -f 4 -d " "`
elif [ "$release" = "\\n" ]; then
release=`head -n 1 /etc/issue | grep "\n" | cut -f 2 -d " "`
elif [ "$release" = "Server" ]; then
release=`head -n 1 /etc/issue | grep "\n" | cut -f 5 -d " "`
elif [ "$release" = "a" ]; then
flavor="PIAF"
release=`head -n 1 /etc/issue | grep "\n" | cut -f 6 -d " "`
fi
if [ "$flavor" = "Debian" -o "$flavor" = "Ubuntu" -o "$flavor" = "Raspbian" ]; then
family="DEB"
else
family="RHEL"
fi
arch=`uname -m`
echo "$family: $flavor $release ($arch)"
Building this in preparation for a unified Incredible PBX installer in case you're wondering.