Hello,
SUSE 9
Bash 2.05b
RPM 4.1.1
I am trying to write a spec file that will install a program, however, if the program is already installed the rpm should exit. In my spec file i check the return code of an 'rpm -q xxxx > /dev/null 2>&1' query. if the package is not found then i can move forward with the installation.
Code:
rpm -q xxxx > /dev/null 2>&1
rc=$?
if["$rc" = 0]
then
.........
fi
However, the return value is always 1. When i remove the pipe to the bit bucket, i see the error "cannot get shared lock on /var/lib/rpm'. It seems to me that this might mean i cant use rpm commands from inside a rpm spec file, since the calling rpm has a lock on the rpm db. Is this true?
if so, does anyone have any good suggestions for checking to see if a package is already installed without using 'rpm -q'?
Thanks.