For my NAS’ e-mail report I wanted to display NAS4Free version. While
uname does give quite a few options, none of them returned all the details I could see on the Status page. And this is where open source shines – source code to the rescue!
Quick investigation has shown that all necessary details are in
util.inc. There in
get_product_name function I’ve found the first hint – set of
prd.* files in
/etc directory. Those files get built with the OS and have all the details needed.
To keep a long story short, this is what I’ve decided upon:
VERSION_TEXT="`cat /etc/prd.name` `$cat /etc/prd.version` `cat /etc/prd.version.name` (revision `cat /etc/prd.revision`)" echo "$VERSION_TEXT"
When ran on my current system, I get “
NAS4Free 10.2.0.2 - Prester (revision 2118)“. Exactly what I needed. :)