TRY THIS Linux Flavor Checker

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. :asshole:

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. :santa:
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,228
kenn10: Fixed above. Guess we need to support our one and only OS. :crazy:

But we shifted gears and decided to stick with the name brand Linux flavors rather than rolling our own.
 

Members online

Forum statistics

Threads
25,825
Messages
167,853
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top