| 1 | #!/bin/sh |
| 2 | |
| 3 | # see Chapter 8 of Debian Linux Kernel Handbook |
| 4 | |
| 5 | set -e |
| 6 | |
| 7 | # conffile still present, but flash-kernel removed |
| 8 | if ! which flash-kernel >/dev/null 2>&1; then |
| 9 | exit 0 |
| 10 | fi |
| 11 | |
| 12 | # this script is used as postinst.d and postrm.d script; this is used to |
| 13 | # differentiate between the two |
| 14 | self="$0" |
| 15 | |
| 16 | # see 8.1, Kernel hooks |
| 17 | abi="$1" |
| 18 | # ignored |
| 19 | _vmlinuz="${2:-/boot/vmlinuz-$abi}" |
| 20 | set -- $DEB_MAINT_PARAMS |
| 21 | action="$1" |
| 22 | action="${action#\'}" |
| 23 | action="${action%\'}" |
| 24 | # ignored |
| 25 | _version="$2" |
| 26 | _version="${version#\'}" |
| 27 | _version="${version%\'}" |
| 28 | |
| 29 | # only call flash-kernel once on install, upgrade, removal or purge |
| 30 | # XXX apparently kernel postinst doesn't always pass maintainer scripts |
| 31 | # arguments |
| 32 | export FK_KERNEL_HOOK_SCRIPT="$(basename "$(dirname "$self")")" |
| 33 | case "$FK_KERNEL_HOOK_SCRIPT/$action" in |
| 34 | postinst.d/configure|postinst.d/|postrm.d/remove|postrm.d/) |
| 35 | exec flash-kernel "$abi" |
| 36 | ;; |
| 37 | esac |
| 38 |