While %postun is running do you have any context of the rpm command line 
options?

On 10/14/2010 10:34 AM, Neale Ferguson wrote:
I have built an RPM that during installation needs to add an entry to
/etc/passwd and /etc/group. This is easy to do using the %pre section:

%pre
egrep -q "^njeanon" /etc/group;                         \
if [ $? != 0  ]; then                                   \
     groupadd nje 2>/dev/null;                           \
     groupadd njeanon 2>/dev/null;                       \
     useradd njeanon -g njeanon;                         \
fi

Similarly, when the RPM is being uninstalled I need to get rid of those
entries. Again, easily done with %postun:

%postun
rm -rf %{nobodyhome}
userdel njeanon 2>/dev/null
groupdel njeanon 2>/dev/null
groupdel nje 2>/dev/null

However, if I am upgrading using -Uhv then I get the %pre and %postun
sections run as part of the upgrade. This means that the work done in %pre
gets undone by %postun. If I was simply doing a rpm --erase I would be
satisfied but doing -U then this is not what I want.

So my question is, how do I prevent -Uhv undoing the %pre work (to be
pedantique if it's doing an upgrade then the groupadds aren't issued because
the check tells me the entries are already there).

Neale

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/




--
Rich Smrcina
Velocity Software, Inc.
Mobile: 414-491-6001
Office: 262-392-3717
http://www.velocitysoftware.com

Catch the WAVV! http://www.wavv.org
WAVV 2011 - April 15-19, 2011 Colorado Springs, CO

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to