kbuild/mkspec: clean boot loader configuration on rpm removal
authorPaolo Abeni <pabeni@redhat.com>
Wed, 2 Mar 2016 14:28:00 +0000 (15:28 +0100)
committerMichal Marek <mmarek@suse.com>
Fri, 4 Mar 2016 21:59:09 +0000 (22:59 +0100)
This patch add a rpm preuninstall scriptlet to cleanup the
boot loader configuration on kernel package uninstall.
The initrd for the to-be-removed kernel is deleted, too.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
scripts/package/mkspec

index fe44d68..b6de63c 100755 (executable)
@@ -138,6 +138,11 @@ echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot
 echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
 echo "fi"
 echo ""
+echo "%preun"
+echo "if [ -x /sbin/new-kernel-pkg ]; then"
+echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img"
+echo "fi"
+echo ""
 echo "%files"
 echo '%defattr (-, root, root)'
 echo "/lib/modules/$KERNELRELEASE"