Dec 132015

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 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/` `$cat /etc/prd.version` `cat /etc/` (revision `cat /etc/prd.revision`)"

When ran on my current system, I get “NAS4Free - Prester (revision 2118)“. Exactly what I needed. :)

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.