Re: Reliable way to determine native packaging system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/14/2013 04:43 PM, Michael Schwendt wrote:
On Thu, 14 Mar 2013 16:09:24 +0100, Reindl Harald wrote:
presence of /var/lib/rpm
/etc/os-release
/etc/redhat-release

And perhaps a run-time check, such as an RPM based query, which would
only work if the RPM database is filled with details about installed
files.

   $ rpm -qa|wc -l
   1601
   $ rpm -qf /sbin/init
   systemd-198-3.fc19.x86_64
   $ rpm -qf $(which bash)
   bash-4.2.45-1.fc19.x86_64


There's no standard way I know of that's guaranteed to work (I think LSB
has some bits that could help but since you can't depend on them being
installed or even available everywhere it's pretty much useless).

You could take a look at how sos does this:

https://github.com/sosreport/sosreport

Sos is a support data collection tool written in python. The upstream
version now runs on Fedora, RHEL, RHEV, RHS, Debian, Ubuntu, Mac OSX,
and Windows. It abstracts package management in a policy class - each
target defines a policy which probes the environment to determine
whether it should be the active policy. So for e.g. if
/etc/fedora-release or /etc/redhat-release exists the redhat policy is
activated.

This is fairly robust and lets you define hierarchies (e.g. the Ubuntu
policy extends Debian policy, and both Debian and Red Hat policies
inherit from a common LinuxPolicy) so that policies can share common
bits of implementation.

The downside is that you have to create and maintain the policies and
either add support for each new flavour or provide generic fall backs
that do a reasonable job on unknown hosts.

Regards,
Bryn.

--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux