[Rpm-maint] post/preun scripts and updating

Paul Nasrat pnasrat at redhat.com
Tue May 29 13:17:51 UTC 2007


On Tue, 2007-05-29 at 15:04 +0200, Lenz, Mario (LDS) wrote:
> Hi!
> 
> I'm not sure if this is the correct mailing list, but I
> havn't found anything else. Maybe you can point me to
> somewhere where I get help if I'm wrong here :-)

This is a development list - (rpm-list at redhat.com is a user list).

> 
> 1) Am I right? If so, I could stop searching for errors I made
> in the spec- file.
> 2) How could I do what I want: Start a daemon when installing
> and stop it when deinstalling, but "update- proof".

See the arguments to scriptlets which is the package count explained
here:

http://rpm.org/max-rpm-snapshot/s1-rpm-inside-scripts.html#S2-RPM-INSIDE-ERASE-TIME-SCRIPTS

Guard your test within tests based on $1 - eg

%postun
if [ $1 = 0 ]; then
        /sbin/service foo stop > /dev/null 2>&1
        /sbin/chkconfig --del foo
fi

Plenty of examples, you may not want to start in %post automatically
just do chkconfig --add as you might be in the installer (yast,
anaconda) not the real system.  A good sysadmin can do service foo start
or if it is the install env, it'll start automagically on first boot.

Paul




More information about the Rpm-maint mailing list