Skip to contentSkip to conversation

mkrpm: Add some post actions.

PATCH In review Don Slutz 3 participants 3 messages Mar 28, 2014 – Apr 1, 2014

lore
Share & tools
lore

Don Slutz

author
#0 lore raw

PATCH 1/1 mkrpm: Add some post actions.

After install:

re-run grub2-mkconfig if valid
run ldconfig to fix shared libraries

After uninstall:

re-run grub2-mkconfig if valid
run ldconfig to fix shared libraries

Also stop if rpmbuild fails so info is left around

---
Added George Dunlap, Not found in MAINTAINERS for this.

 tools/misc/mkrpm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
tools/misc/mkrpm +11 -1
index a9aa5e2..3e00be0 100644
@@ -66,10 +66,20 @@ rm -rf \$RPM_BUILD_ROOT
 /*
 
 %post
+if [ -f /sbin/grub2-mkconfig -a -f /boot/grub2/grub.cfg ]; then
+  /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
+fi
+ldconfig
+
+%postun
+if [ -f /sbin/grub2-mkconfig -a -f /boot/grub2/grub.cfg ]; then
+  /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
+fi
+ldconfig
 EOF
 
 # Package it up
-rpmbuild --define "_xenroot $xenroot" --define "_topdir $PWD/rpm" -bb rpm/SPECS/xen.spec
+rpmbuild --define "_xenroot $xenroot" --define "_topdir $PWD/rpm" -bb rpm/SPECS/xen.spec || exit 1
 
 # Tidy up after ourselves
 mv rpm/RPMS/*/*.rpm .
Signature · 1 line
1.8.4
#1 lore raw
Quoted 4 lines · Don Slutz

After install:

re-run grub2-mkconfig if valid
run ldconfig to fix shared libraries

At least for the Debian equivalent we explicitly do not do this sort of thing and have nacked such patches in the past.

The deb integration stuff is intended to be exactly "a tarball which can be uninstalled", no more. Perhaps George has other opinions wrt to the RPM stuff.

Please see the archives for previous discussions wrt the deb stuff (I think there was a patch from Fabio in particular which spawned a thread similar to what I imagine this one will become).

Ian.

#2 lore raw
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Don Slutz

After install:

re-run grub2-mkconfig if valid
run ldconfig to fix shared libraries

At least for the Debian equivalent we explicitly do not do this sort of thing and have nacked such patches in the past.

Quoted 7 lines

The deb integration stuff is intended to be exactly "a tarball which can be uninstalled", no more. Perhaps George has other opinions wrt to the RPM stuff.

Please see the archives for previous discussions wrt the deb stuff (I think there was a patch from Fabio in particular which spawned a thread similar to what I imagine this one will become).

IIRC the issue there was in part about not wanting to officially maintain / support the package as a package. Making it a bit hobbled (not updating grub2 or calling ldconfig again) was seen as something to help keep it developer-only.

However, if there were enough commonality between the various downstreams that build RPMs (Fedora, CentOS, XenServer), would it make sense to try to make a standard spec file shared between them?

Just tossing this out there... I don't really know how useful it will be in practice.

-George