<div dir="ltr">Hi Fred,<div><br></div><div>You should checkout how Virtualmin does system version detection.</div><div><br></div><div><a href="http://software.virtualmin.com/lib/oschooser.pl">http://software.virtualmin.com/lib/oschooser.pl</a><br>
</div><div><a href="http://software.virtualmin.com/lib/os_list.txt">http://software.virtualmin.com/lib/os_list.txt</a><br></div><div><br></div><div>Dan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 11 June 2014 23:51, Todd Rinaldo <span dir="ltr"><<a href="mailto:toddr@cpanel.net" target="_blank">toddr@cpanel.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On Jun 10, 2014, at 2:44 PM, Manuel Wolfshant <<a href="mailto:wolfy@nobugconsulting.ro">wolfy@nobugconsulting.ro</a>> wrote:<br>
<br>
> On 06/10/2014 10:37 PM, Fred Smith wrote:<br>
>> On Tue, Jun 10, 2014 at 10:28:26PM +0300, Manuel Wolfshant wrote:<br>
>>>    On 06/10/2014 06:28 PM, Daniel Ankers wrote:<br>
>>><br>
>>>    On 10 June 2014 16:19, Fred<br>
>>>    Smith <[1]<a href="mailto:fredex@fcshome.stoneham.ma.us">fredex@fcshome.stoneham.ma.us</a>> wrote:<br>
>>><br>
>>>      Hi all!<br>
>>>      I think it was on this list, in the last week or so I saw some<br>
>>>      comment<br>
>>>      about how some apps may grope the contents of /etc/redhat-release<br>
>>>      when<br>
>>>      installing themselves, so as to figure how which OS they're running<br>
>>>      on,<br>
>>>      and there was some mention of this not being the best of all<br>
>>>      possible<br>
>>>      ideas.<br>
>>><br>
>>>    Hi Fred,<br>
>>>    I would have thought that "lsb_release -a" would be far more portable<br>
>>>    across varying different distributions and versions.<br>
>>>    Regards,<br>
>>>    Dan<br>
>> Dan, this app is installed only on RHEL or Centos systems, so cross-<br>
>> distribution issues don't come up (if yu try to run the installer on,<br>
>> say, SUSE, it'll just error out with "unknown/incorrect distribution"<br>
>> or something similar.)<br>
>><br>
>> So the pain comes simply in telling which RHEL or centos it is. While<br>
>> I'm sure someone smarter could parse /etc/redhat-release in fewer lines<br>
>> of code than I have, it's still a pain and prone to breakage with each<br>
>> new version. that's where lsb_release -i -r should make life simpler.<br>
> rpm -q should make life much easier if you already know you are on<br>
> centos/RHEL.  just rpm -q --qf  "%{vendor}\n" kernel or glibc or<br>
> filesystem any other mandatory package to discriminate between the two<br>
> families of distributions and then rpm -q --qf "apropriate fields here "<br>
> centos-release / redhat-release  to find out anything else you need.<br>
><br>
</div></div>We've been cursing this week that we didn't now about lsb_release. Just the same, our trick was similar to yours:<br>
<br>
rpm -qf --queryformat '%{VERSION}\n' /etc/redhat-release<br>
<br>
Which gets me the distro version, regardless of what RHEL derivative I'm querying. Yes, you're out of luck on SUSE but luckily that wasn't in my problem set.<br>
<span class="HOEnZb"><font color="#888888"><br>
Todd<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
CentOS-devel mailing list<br>
<a href="mailto:CentOS-devel@centos.org">CentOS-devel@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos-devel" target="_blank">http://lists.centos.org/mailman/listinfo/centos-devel</a><br>
</div></div></blockquote></div><br></div>