Only remove the special uInitrd when remove kernel
`initrd.img-${version}` will be remove by command `update-initramfs -d -k "${version}"`,
so we don't need to care about it.
This commit is contained in:
parent
d147e5a9a7
commit
1c9ec236bd
@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
# echo "DEBUG: postinst: initramfs-clean: cmd: $@" >&2
|
||||
# avoid running multiple times
|
||||
# This script should be run after the initramfs-tools script
|
||||
# and under the same conditions.
|
||||
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
eval set -- "$DEB_MAINT_PARAMS"
|
||||
if [ -z "$1" ] || [ "$1" != "configure" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
files="$(find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*')"
|
||||
|
||||
for f in $files; do
|
||||
if [ ! -d /lib/modules/"${f#*-}" ]; then
|
||||
echo "Remove unused generated file: $f"; rm $f
|
||||
fi
|
||||
done
|
||||
|
||||
check_boot_dev (){
|
||||
available_size_boot_device=$(findmnt --noheadings --output AVAIL --target /boot)
|
||||
echo "Free space after deleting the package $DPKG_MAINTSCRIPT_PACKAGE in /boot: $available_size_boot_device" >&2
|
||||
}
|
||||
mountpoint -q /boot && check_boot_dev
|
||||
|
||||
exit 0
|
||||
20
packages/bsp/common/etc/kernel/postrm.d/initramfs-remove-uInitrd
Executable file
20
packages/bsp/common/etc/kernel/postrm.d/initramfs-remove-uInitrd
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Remove /boot/uInitrd-${version} created by /etc/initramfs/post-update.d/99-uboot
|
||||
# Unfortunately, `update-initramfs` only support `post-update.d`, doesn't have something like `post-delete.d`
|
||||
# So let's clean it when we remove a kernel.
|
||||
|
||||
version="$1"
|
||||
|
||||
# avoid running multiple times
|
||||
# Use the same conditions as `initramfs-tools`.
|
||||
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
eval set -- "$DEB_MAINT_PARAMS"
|
||||
if [ -z "$1" ] || [ "$1" != "remove" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f "/boot/uInitrd-${version}"
|
||||
|
||||
exit 0
|
||||
@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
# echo "DEBUG: POSTRM: initramfs-clean: cmd: $@" >&2
|
||||
# avoid running multiple times
|
||||
# This script should be run after the initramfs-tools script
|
||||
# and under the same conditions.
|
||||
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
eval set -- "$DEB_MAINT_PARAMS"
|
||||
if [ -z "$1" ] || [ "$1" != "remove" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
files="$(find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*')"
|
||||
|
||||
for f in $files; do
|
||||
if [ ! -d /lib/modules/"${f#*-}" ]; then
|
||||
echo "Remove unused generated file: $f"; rm $f
|
||||
fi
|
||||
done
|
||||
|
||||
check_boot_dev (){
|
||||
available_size_boot_device=$(findmnt --noheadings --output AVAIL --target /boot)
|
||||
echo "Free space after deleting the package $DPKG_MAINTSCRIPT_PACKAGE in /boot: $available_size_boot_device" >&2
|
||||
}
|
||||
mountpoint -q /boot && check_boot_dev
|
||||
|
||||
exit 0
|
||||
Loading…
Reference in New Issue
Block a user