[CentOS-devel] /etc/redhat-release

Dan Porter

dpreid at gmail.com
Thu Jun 12 09:58:31 UTC 2014


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

Dan


On 11 June 2014 23:51, Todd Rinaldo <toddr at cpanel.net> wrote:

>
> On Jun 10, 2014, at 2:44 PM, Manuel Wolfshant <wolfy at nobugconsulting.ro>
> wrote:
>
> > On 06/10/2014 10:37 PM, Fred Smith wrote:
> >> On Tue, Jun 10, 2014 at 10:28:26PM +0300, Manuel Wolfshant wrote:
> >>>    On 06/10/2014 06:28 PM, Daniel Ankers wrote:
> >>>
> >>>    On 10 June 2014 16:19, Fred
> >>>    Smith <[1]fredex at fcshome.stoneham.ma.us> wrote:
> >>>
> >>>      Hi all!
> >>>      I think it was on this list, in the last week or so I saw some
> >>>      comment
> >>>      about how some apps may grope the contents of /etc/redhat-release
> >>>      when
> >>>      installing themselves, so as to figure how which OS they're
> running
> >>>      on,
> >>>      and there was some mention of this not being the best of all
> >>>      possible
> >>>      ideas.
> >>>
> >>>    Hi Fred,
> >>>    I would have thought that "lsb_release -a" would be far more
> portable
> >>>    across varying different distributions and versions.
> >>>    Regards,
> >>>    Dan
> >> Dan, this app is installed only on RHEL or Centos systems, so cross-
> >> distribution issues don't come up (if yu try to run the installer on,
> >> say, SUSE, it'll just error out with "unknown/incorrect distribution"
> >> or something similar.)
> >>
> >> So the pain comes simply in telling which RHEL or centos it is. While
> >> I'm sure someone smarter could parse /etc/redhat-release in fewer lines
> >> of code than I have, it's still a pain and prone to breakage with each
> >> new version. that's where lsb_release -i -r should make life simpler.
> > rpm -q should make life much easier if you already know you are on
> > centos/RHEL.  just rpm -q --qf  "%{vendor}\n" kernel or glibc or
> > filesystem any other mandatory package to discriminate between the two
> > families of distributions and then rpm -q --qf "apropriate fields here "
> > centos-release / redhat-release  to find out anything else you need.
> >
> We've been cursing this week that we didn't now about lsb_release. Just
> the same, our trick was similar to yours:
>
> rpm -qf --queryformat '%{VERSION}\n' /etc/redhat-release
>
> 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.
>
> Todd
>
>
> _______________________________________________
> CentOS-devel mailing list
> CentOS-devel at centos.org
> http://lists.centos.org/mailman/listinfo/centos-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20140612/3502aed4/attachment-0003.html>


More information about the CentOS-devel mailing list