Discovering Linux 'Distro' Facts
This article documents my version of
whatdistro, I needed a User Procedure to report certain distro facts. I wrote a script called showdistro which works on a bunch of distros with varying verboseness. This is now implemented as a function on github : https://github.com/dfl1955/ubuntu-tools/blob/master/dfl1955_functions implemented as
I originally did this because I was building out parts of the Citihub web site monitoring solution using Zabbix and decided that I need a User Procedure to report certain distro facts since we seem to be using whatever OS the solution author feels like. (We have several Linux distros within the web site. Zabbix comes with a number of agents which report certain static facts about the systems being monitored, and these have been the inspiration for this piece of work.
I have written a program (shell script) that browses and parses /etc/*-release. It has been tested for RHES, SUSE, Fedora and Ubuntu 10. It ends with status 0 if it works OK and 1 for a universal error i.e. if it cannot detect and parse the *-release files. It replies status 10 if neither lsb-release nor system-release files are present, and status 255 if it is not Linux. I put this program in /usr/local/bin.
This page, called Find out my Linux distribution name and version at http://www.cyberciti.biz was very useful and documented the use of the /etc/*-release files.