summaryrefslogtreecommitdiffstats
path: root/scripts/prune-kernel
diff options
context:
space:
mode:
authorReza Arbab <arbab@linux.ibm.com>2022-05-04 16:27:14 -0500
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-11 21:46:38 +0900
commit5d53508d1bae79a84840bcfd3c45094d2081d6d2 (patch)
tree3872e44379ab701be133ea3fcd876f1036dbd90a /scripts/prune-kernel
parentf774f5bb87d132b48bc4a99598c45f35121ac054 (diff)
downloadlinux-stable-5d53508d1bae79a84840bcfd3c45094d2081d6d2.tar.gz
linux-stable-5d53508d1bae79a84840bcfd3c45094d2081d6d2.tar.bz2
linux-stable-5d53508d1bae79a84840bcfd3c45094d2081d6d2.zip
scripts/prune-kernel: Use kernel-install if available
If the new-kernel-pkg utility isn't present, try using kernel-install. This is what the %preun scriptlet in scripts/package/mkspec does too. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/prune-kernel')
-rwxr-xr-xscripts/prune-kernel6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/prune-kernel b/scripts/prune-kernel
index e8aa940bc0a9..dadfd0e47f89 100755
--- a/scripts/prune-kernel
+++ b/scripts/prune-kernel
@@ -16,6 +16,10 @@ do
rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f"
rm -f "/boot/vmlinuz-$f" "/boot/config-$f"
rm -rf "/lib/modules/$f"
- new-kernel-pkg --remove $f
+ if [ -x "$(command -v new-kernel-pkg)" ]; then
+ new-kernel-pkg --remove $f
+ elif [ -x "$(command -v kernel-install)" ]; then
+ kernel-install remove $f
+ fi
fi
done