[CentOS-devel] /etc/redhat-release

Thu Jun 12 10:29:59 UTC 2014
Farkas Levente <lfarkas at lfarkas.org>

On 06/12/2014 12:04 PM, John R. Dennison wrote:
> On Thu, Jun 12, 2014 at 10:58:31AM +0100, Dan Porter wrote:
>> Hi Fred,
>> 
>> You should checkout how Virtualmin does system version
>> detection.
>> 
>> http://software.virtualmin.com/lib/oschooser.pl 
>> http://software.virtualmin.com/lib/os_list.txt
> 
> Which does it the 100% wrong way.
> 
> Again, contents of /etc/*-release _can not be trusted_.

the proper way for this is:
rpm -q --nosignature --qf "%{VERSION}" --whatprovides redhat-release
2>/dev/null
this is working on all rhel/centos/sl etc and even on fedora.

-- 
  Levente                               "Si vis pacem para bellum!"