diff --git a/.update/pre-patches b/.update/pre-patches index 164470933a..c7894e8ccf 100644 --- a/.update/pre-patches +++ b/.update/pre-patches @@ -96,5 +96,29 @@ then G_EXEC sed -i '/^Package:/c\Package: openbox* obconf* libob* pcmanfm* libfm* libgtk* lx*' /etc/apt/preferences.d/dietpi-lxde fi +# v7.7 +if (( $G_DIETPI_VERSION_CORE < 7 || ( $G_DIETPI_VERSION_CORE == 7 && $G_DIETPI_VERSION_SUB < 7 ) )) [[ $G_HW_ARCH == 10 && $(findmnt -Ufnro FSTYPE -M /boot) == 'vfat' ]] +then + G_DIETPI-NOTIFY 2 'Creating kernel upgrade hook to remove existing files from /boot FAT partition before installing the new files: https://github.com/MichaIng/DietPi/issues/4785' + G_EXEC mkdir -p /etc/kernel/preinst.d + cat << '_EOF_' > /etc/kernel/preinst.d/dietpi +#!/bin/sh -e +# Remove old kernel files if existing: https://github.com/MichaIng/DietPi/issues/4788 +{ +# Fail if the package name was not passed, which is done when being invoked by dpkg +if [ -z "$DPKG_MAINTSCRIPT_PACKAGE" ] +then + echo 'DPKG_MAINTSCRIPT_PACKAGE was not set, this script must be invoked by dpkg.' + exit 1 +fi +# Loop through files in /boot, shipped by the package, and remove them, if existing +for file in $(dpkg -L "$DPKG_MAINTSCRIPT_PACKAGE" | grep '^/boot/') +do + [ ! -f "$file" ] || rm "$file" +done +} +_EOF_ +fi + exit 0 }