1
0
Files
linux/debian/templates/image.prerm.in
2025-05-29 17:14:07 +03:00

29 lines
629 B
Bash

#!/bin/sh
set -e
[ "$1" = remove ] || exit 0
version='@abiname@@localversion@'
image_path="/boot/@image-stem@-${version}"
have_cmd() { command -v "$1" >/dev/null || return 1 ; }
if have_cmd linux-check-removal ; then
linux-check-removal "${version}"
fi
if have_cmd linux-run-hooks ; then
## linux-base (>= 4.12~)
linux-run-hooks image prerm "${version}" "${image_path}" -- "$@"
else
if [ -d /etc/kernel/prerm.d ] ; then
DEB_MAINT_PARAMS="$*" \
run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/prerm.d
fi
fi
exit 0