diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh index 388510c71dcf..01eb3ca69501 100644 --- a/lib/functions/compilation/kernel-debs.sh +++ b/lib/functions/compilation/kernel-debs.sh @@ -235,6 +235,19 @@ function kernel_package_callback_linux_image() { test -d ${debian_kernel_hook_dir}/${script}.d && run-parts --arg="${kernel_version_family}" --arg="/${installed_image_path}" ${debian_kernel_hook_dir}/${script}.d KERNEL_HOOK_DELEGATION + if [[ "${script}" == "preinst" ]]; then + cat <<- HOOK_FOR_REMOVE_VFAT_BOOT_FILES + check_boot_dev (){ + boot_partition=\$(findmnt -n -o SOURCE /boot) + bootfstype=\$(blkid -s TYPE -o value \$boot_partition) + if [ "\$bootfstype" = "vfat" ]; then + rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage + fi + } + mountpoint -q /boot && check_boot_dev + HOOK_FOR_REMOVE_VFAT_BOOT_FILES + fi + # @TODO: only if u-boot, only for postinst. Gotta find a hook scheme for these... if [[ "${script}" == "postinst" ]]; then cat <<- HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL