Skip to content

Commit

Permalink
v7.7
Browse files Browse the repository at this point in the history
+ DietPi-Pre-patch | On x86_64 with /boot FAT partition, create kernel upgrade hook to remove existing files from /boot before installing the new files: #4785
  • Loading branch information
MichaIng authored Sep 29, 2021
1 parent ee8ad81 commit 1e8143f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .update/pre-patches
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 1e8143f

Please sign in to comment.