Re: RPM DB locked(?)/Access to Update Release Info?

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

 




On Jan 6, 2006, at 6:42 AM, Christian.Rohrmeier@xxxxxxxxxxx wrote:



Hello All,

I am writing an RPM for RHEL 2.1. In it, I need to take actions in the
%post script depending on the Update Release (e.g. RHEL 2.1 WS Update 3).

The two ways I have tried to find this information has been:

1) Reading /etc/redhat-release. This is unfortunately inconsistent.
Examples:
RHEL 2.1 WS Update 5 says: "Red Hat Enterprise Linux WS release 2.1
U5 (Tampa)"
RHEL 2.1 WS Update 5 says: "Red Hat Enterprise Linux WS release 2.1
(Tampa)"
RHEL 2.1 AS Update 6 says : "Red Hat Linux Advanced Server release
2.1AS (Pensacola)"
Therefor I cannot rely upon /etc/redhat-release to provide me with the
update release information under RHEL 2.1 (however RHEL 3 and 4 have a
consistent format).


(aside) You can certainly deal with the know variations of the strings, "cannot rely" is total FUD.

2) Reading the redhat-release package information. Technically this
contains the information (albeit in a peculiar form):

RHEL 2.1 WS Update 5:
# rpm -qa | grep redhat-release
redhat-release-ws-2.1WS-18

RHEL 2.1 WS Update 6:
# rpm -qa | grep redhat-release
redhat-release-ws-2.1WS-20

I guess Update 5 is release "18" and Update 6 is release "20". Okay, fine
by me.

I need this information in my %post script. However, under RHEL 2.1, here's
what happens when my %postscript contains the following line:
INFO=`rpm -qa | grep redhat-release`

# rpm -ivh test-1.0-1.noarch.rpm
Preparing... ###########################################
[100%]
error: cannot get shared lock on /var/lib/rpm/Packages
error: cannot open Packages index using db3 - Operation not permitted (1)

This works with RHEL 3 and 4 however.

So, here's my primary question:
How do I find out the Update Release of an RHEL 2.1 System, in a form that
I can use in an RPM %post script?


The /etc/redhat-release file was (and prolly still is) the "supported" mechanism in AS 2.1 for determining
the distribution release.

Further, how indeed do I get access to any RPM database information from
with an RPM %post script?


The version of rpm in AS 2.1 is too old (as in hadn't been implemented yet) to support concurrent access reliably.

If all you need is the version of redhat-release installed, then try
    grep redhat-release /var/log/rpmpkgs

That file lists all packages installed and should be portable as well.

Seeing as how the whole idea of RPM is to take appropriate action based on the versions of other installed software packages, there must be a way to
access such information on RHEL 2.1.


Heh, basing packaging on vendor release info is intrinsically flawed, and is certainly
not the "whole idea of RPM ...". But lets not go there ...

73 de Jeff

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux