1
0
linux/debian/templates/image.postrm.in
Konstantin Demin eb2bdc81cb rewrite scripts
try to provide better syntax and avoid using bash
2024-10-29 05:12:06 +03:00

55 lines
1.3 KiB
Bash

#!/bin/sh
set -e
version='@abiname@@localversion@'
image_path="/boot/@image-stem@-${version}"
rm -f "/lib/modules/${version}/.fresh-install"
if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null ; then
linux-update-symlinks remove "${version}" "${image_path}"
fi
if [ -d /etc/kernel/postrm.d ] ; then
DEB_MAINT_PARAMS="$*" \
run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/postrm.d
fi
if [ "$1" = purge ]; then
for extra_file in \
'modules.*.bin' \
modules.alias \
modules.ccwmap \
modules.dep \
modules.devname \
modules.generic_string \
modules.ieee1394map \
modules.inputmap \
modules.isapnpmap \
modules.ofmap \
modules.parportmap \
modules.pcimap \
modules.pnpbiosmap \
modules.seriomap \
modules.softdep \
modules.symbols \
modules.usbmap \
modules.weakdep \
; do
case "${extra_file}" in
*\** | *\?* )
find "/lib/modules/${version}/" -mindepth 1 -maxdepth 1 -name "${extra_file}" -exec rm -f {} +
;;
* )
rm -f "/lib/modules/${version}/${extra_file}"
;;
esac
done
rmdir "/lib/modules/${version}" || true
fi
exit 0