Bug 59319 - Using rpm from within %post install-script fails
Using rpm from within %post install-script fails
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
7.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-02-05 04:35 EST by Fritz Elfert
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-02-05 04:37:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
specfile for creating an RPM which waits in %post until /tmp/rpmloop is removed (454 bytes, text/plain)
2002-02-05 04:37 EST, Fritz Elfert
no flags Details

  None (edit)
Description Fritz Elfert 2002-02-05 04:35:13 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.78 [de] (X11; U; Linux 2.4.9-21 i686; Nav)

Description of problem:
I'm currently building some packages which depend on a relocatable
third-party package (IBMJava2-SDK) and need to create some symlinks
depending on _where_ the user actually has installed IBMJava2-SDK.
Since installation of IBMJava2-SDK does not create any system-wide
config files, tried to retrieve the prefix using the following
line in my %post script

JDKPREFIX=`rpm -q --queryformat '%{INSTALLPREFIX}\n' IBMJava2-SDK`

however when executing, i get the following error:

error: cannot get shared lock on /var/lib/rpm/Packages
error: cannot open Packages index using db3 - Operation not permitted (1)

If i would do a write-operation on the database, i would understand
this error, but a query should open the rpm-db read-only?!



Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create a dummy RPM with the attached spec.
2. Install this RPM, it will hang in until you delete /tmp/rpmloop
3. On a second console, try some rpm queries, they will fail.


Additional info:
Comment 1 Fritz Elfert 2002-02-05 04:37:12 EST
Created attachment 44517 [details]
specfile for creating an RPM which waits in %post until /tmp/rpmloop is removed
Comment 2 Jeff Johnson 2002-02-05 09:59:12 EST
You can't invoke rpm from %post et al scriptlets
because (as you have seen) the rpmdb has an
exclusive lock.

The install prefix that you want is in an environment
variable. Build a test package with
	%post
	env
	exit 1
build, install with relocation, and you'll see the environment
variable you want.
Comment 3 Fritz Elfert 2002-02-05 11:55:48 EST
You misunderstood,

I want to retrieve the install-prefix of _ANOTHER_ (thirparty),
previously installed relocatable package from within the
%post script of _MY_ package, _NOT_ the prefix of my package (that would
be too easy ;-))
Comment 4 Jeff Johnson 2002-02-05 12:03:29 EST
Then you can't do that from a %post scriptlet.

You might try using slocate to find a file from the other
package. Another alternative is to explicitly restrict
relocations to a known set, and check each member of
the set for installation.

There's also the quick hack of passing an environment
variable to the %post scriptlet from a query performed
before attempting an install. Not recommended, but I
believe that will work.

Note You need to log in before you can comment on or make changes to this bug.