<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">&lt;<a href="mailto:toddr@cpanel.net" target="_blank">toddr@cpanel.net</a>&gt;</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 &lt;<a href="mailto:wolfy@nobugconsulting.ro">wolfy@nobugconsulting.ro</a>&gt; wrote:<br>
<br>
&gt; On 06/10/2014 10:37 PM, Fred Smith wrote:<br>
&gt;&gt; On Tue, Jun 10, 2014 at 10:28:26PM +0300, Manuel Wolfshant wrote:<br>
&gt;&gt;&gt;    On 06/10/2014 06:28 PM, Daniel Ankers wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    On 10 June 2014 16:19, Fred<br>
&gt;&gt;&gt;    Smith &lt;[1]<a href="mailto:fredex@fcshome.stoneham.ma.us">fredex@fcshome.stoneham.ma.us</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;      Hi all!<br>
&gt;&gt;&gt;      I think it was on this list, in the last week or so I saw some<br>
&gt;&gt;&gt;      comment<br>
&gt;&gt;&gt;      about how some apps may grope the contents of /etc/redhat-release<br>
&gt;&gt;&gt;      when<br>
&gt;&gt;&gt;      installing themselves, so as to figure how which OS they&#39;re running<br>
&gt;&gt;&gt;      on,<br>
&gt;&gt;&gt;      and there was some mention of this not being the best of all<br>
&gt;&gt;&gt;      possible<br>
&gt;&gt;&gt;      ideas.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    Hi Fred,<br>
&gt;&gt;&gt;    I would have thought that &quot;lsb_release -a&quot; would be far more portable<br>
&gt;&gt;&gt;    across varying different distributions and versions.<br>
&gt;&gt;&gt;    Regards,<br>
&gt;&gt;&gt;    Dan<br>
&gt;&gt; Dan, this app is installed only on RHEL or Centos systems, so cross-<br>
&gt;&gt; distribution issues don&#39;t come up (if yu try to run the installer on,<br>
&gt;&gt; say, SUSE, it&#39;ll just error out with &quot;unknown/incorrect distribution&quot;<br>
&gt;&gt; or something similar.)<br>
&gt;&gt;<br>
&gt;&gt; So the pain comes simply in telling which RHEL or centos it is. While<br>
&gt;&gt; I&#39;m sure someone smarter could parse /etc/redhat-release in fewer lines<br>
&gt;&gt; of code than I have, it&#39;s still a pain and prone to breakage with each<br>
&gt;&gt; new version. that&#39;s where lsb_release -i -r should make life simpler.<br>
&gt; rpm -q should make life much easier if you already know you are on<br>
&gt; centos/RHEL.  just rpm -q --qf  &quot;%{vendor}\n&quot; kernel or glibc or<br>
&gt; filesystem any other mandatory package to discriminate between the two<br>
&gt; families of distributions and then rpm -q --qf &quot;apropriate fields here &quot;<br>
&gt; centos-release / redhat-release  to find out anything else you need.<br>
&gt;<br>
</div></div>We&#39;ve been cursing this week that we didn&#39;t now about lsb_release. Just the same, our trick was similar to yours:<br>
<br>
rpm -qf --queryformat &#39;%{VERSION}\n&#39; /etc/redhat-release<br>
<br>
Which gets me the distro version, regardless of what RHEL derivative I&#39;m querying. Yes, you&#39;re out of luck on SUSE but luckily that wasn&#39;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>