Skip to content

Commit

Permalink
remove files in /boot at preinst when bootfs is vfat (#4886)
Browse files Browse the repository at this point in the history
* remove files in /boot at preinst when bootfs is vfat

* use findmnt to get /boot source device
  • Loading branch information
amazingfate authored Mar 1, 2023
1 parent 755479f commit 6c758e6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/functions/compilation/kernel-debs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c758e6

Please sign in to comment.