| 1 |
#! /bin/sh |
| 2 |
set -e |
| 3 |
|
| 4 |
command -v update-grub >/dev/null || exit 0 |
| 5 |
|
| 6 |
if type systemd-detect-virt >/dev/null 2>&1 && |
| 7 |
systemd-detect-virt --quiet --container; then |
| 8 |
exit 0 |
| 9 |
fi |
| 10 |
|
| 11 |
set -- $DEB_MAINT_PARAMS |
| 12 |
mode="${1#\'}" |
| 13 |
mode="${mode%\'}" |
| 14 |
case $0:$mode in |
| 15 |
# Only run on postinst configure and postrm remove, to avoid wasting |
| 16 |
# time by calling update-grub multiple times on upgrade and removal. |
| 17 |
# Also run if we have no DEB_MAINT_PARAMS, in order to work with old |
| 18 |
# kernel packages. |
| 19 |
*/postinst.d/*:|*/postinst.d/*:configure|*/postrm.d/*:|*/postrm.d/*:remove) |
| 20 |
if [ -e /boot/grub/grub.cfg ]; then |
| 21 |
exec update-grub |
| 22 |
fi |
| 23 |
;; |
| 24 |
esac |
| 25 |
|
| 26 |
exit 0 |