Reliable way to determine native packaging system
Theodore Papadopoulo
Theodore.Papadopoulo at inria.fr
Thu Mar 14 18:27:27 UTC 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/14/2013 06:39 PM, Bryn M. Reeves wrote:
> 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.
>
Interesting, I'll have a look. But the downside you mention is exactly
the one I want to avoid. Having to handle a mapping between
distributions and packaging systems. See the other message I just
posted...
Anyway thnk for this pointer.
Theo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlFCFo4ACgkQEr8WrU8nPV1k6ACgtBe+PL4UVchJkEUOjfkyttkU
uRwAoKE5FHLzSKKuHc1MC5LtETndvYRB
=wN1i
-----END PGP SIGNATURE-----
More information about the users
mailing list