Release with postun scripts when renaming a munin package

I have two problems that I would like to find a solution for:

I rename the munin 2.0 package and I have to obsolete the original munin packages in the SPEC file for RPM.

When replacing the existing 1.x munin package as part of the postun munin-node scripts, it removes the munin user.

postuninstall scriptlet (using /bin/sh): if [ $1 -eq 0 ]; then /usr/sbin/userdel munin || logger -t munin/rpm "User \"munin\" could not be deleted." # /usr/sbin/groupdel munin || logger -t munin/rpm "Group \"munin\" could not be deleted." fi 

When I replace the existing munin 2.0 package, postun deletes the contents of the plugin directory.

 postuninstall scriptlet (using /bin/sh): if [ "$1" = "0" ]; then [ -d /etc/munin/plugins ] && \ find /etc/munin/plugins/ -maxdepth 1 -type l -print0 | \ xargs -0 rm || : fi 

Since yum installs a new package and then runs messages for the old package and $1 = 0 , in both cases it runs scripts after installing rpms. Is there any way around this?

+7
source share
1 answer

The only thing I can think of is to hack when you copy the contents of %pre to another location, and then %trigger when deleting another package to return it. Not the best form, but it can work. It also requires that you be installed before uninstalling.

0
source

All Articles