| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# cargo-culted from grub |
| 6 |
merge_debconf_into_conf() { |
| 7 |
local tmpfile; tmpfile="$1" |
| 8 |
local setting; setting="$2" |
| 9 |
local template; template="$3" |
| 10 |
|
| 11 |
db_get "$template" |
| 12 |
local value; value="$(echo "$RET" | sed -e 's,[$`"\],\\&,g')" |
| 13 |
if grep -q "^${setting}=" "$tmpfile"; then |
| 14 |
value="$(echo "$value" | sed -e 's,[\@],\\&,g')" |
| 15 |
sed -i -re "s@^(${setting}=).*@\1\"${value}\"@" "$tmpfile" |
| 16 |
else |
| 17 |
echo >> "$tmpfile" |
| 18 |
echo "${setting}=\"${value}\"" >> "$tmpfile" |
| 19 |
fi |
| 20 |
} |
| 21 |
|
| 22 |
case "$1" in |
| 23 |
configure) |
| 24 |
. /usr/share/debconf/confmodule |
| 25 |
|
| 26 |
tmp_default_fk="/etc/default/flash-kernel.ucftmp" |
| 27 |
trap "rm -f ${tmp_default_fk}" EXIT |
| 28 |
cp -p /usr/share/flash-kernel/default/flash-kernel \ |
| 29 |
${tmp_default_fk} |
| 30 |
merge_debconf_into_conf "$tmp_default_fk" \ |
| 31 |
LINUX_KERNEL_CMDLINE flash-kernel/linux_cmdline |
| 32 |
|
| 33 |
ucf --three-way --debconf-ok ${tmp_default_fk} \ |
| 34 |
/etc/default/flash-kernel |
| 35 |
ucfr flash-kernel /etc/default/flash-kernel |
| 36 |
;; |
| 37 |
triggered|abort-upgrade|abort-remove|abort-deconfigure) |
| 38 |
;; |
| 39 |
*) |
| 40 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 41 |
exit 1 |
| 42 |
;; |
| 43 |
esac |
| 44 |
|
| 45 |
case "$1" in |
| 46 |
triggered) |
| 47 |
# this forces flash-kernel to run rather than setting our trigger to |
| 48 |
# cause a later run (as happens without _NOTRIGGER being set) |
| 49 |
FLASH_KERNEL_NOTRIGGER=y flash-kernel |
| 50 |
;; |
| 51 |
*) |
| 52 |
flash-kernel |
| 53 |
;; |
| 54 |
esac |
| 55 |
|
| 56 |
#DEBHELPER# |