kbuild: rpm-pkg: use kernel-install as a fallback for new-kernel-pkg
authorJavier Martinez Canillas <javierm@redhat.com>
Wed, 11 Apr 2018 18:15:24 +0000 (20:15 +0200)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 13 Apr 2018 14:18:41 +0000 (23:18 +0900)
The new-kernel-pkg script is only present when grubby is installed, but it
may not always be the case. So if the script isn't present, attempt to use
the kernel-install script as a fallback instead.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/package/mkspec

index 61427c6f220922542c661b844553ed6857993a09..e05646dc24dcf633830ce6d8dd3da5f71a29731e 100755 (executable)
@@ -118,6 +118,8 @@ $S$M        ln -sf /usr/src/kernels/$KERNELRELEASE source
        %preun
        if [ -x /sbin/new-kernel-pkg ]; then
        new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img
+       elif [ -x /usr/bin/kernel-install ]; then
+       kernel-install remove $KERNELRELEASE
        fi
 
        %postun