File: flash-kernel.postinst

package info (click to toggle)
flash-kernel 3.104
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 712 kB
  • sloc: sh: 519; makefile: 36
file content (48 lines) | stat: -rwxr-xr-x 1,143 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

set -e

# cargo-culted from grub
merge_debconf_into_conf() {
	local tmpfile; tmpfile="$1"
	local setting; setting="$2"
	local template; template="$3"

	db_get "$template"
	local value; value="$(echo "$RET" | sed -e 's,[$`"\],\\&,g')"
	if grep -q "^${setting}=" "$tmpfile"; then
		value="$(echo "$value" | sed -e 's,[\@],\\&,g')"
		sed -i -re "s@^(${setting}=).*@\1\"${value}\"@" "$tmpfile"
	else
		echo >> "$tmpfile"
		echo "${setting}=\"${value}\"" >> "$tmpfile"
	fi
}

case "$1" in
	configure)
		. /usr/share/debconf/confmodule

		tmp_default_fk="$(mktemp -t flash-kernel.XXXXXXXXXX)"
		trap "rm -f ${tmp_default_fk}" EXIT
		cp -p /usr/share/flash-kernel/default/flash-kernel \
			${tmp_default_fk}
		merge_debconf_into_conf "$tmp_default_fk" \
			LINUX_KERNEL_CMDLINE flash-kernel/linux_cmdline

		ucf --three-way --debconf-ok ${tmp_default_fk} \
			/etc/default/flash-kernel
		ucfr flash-kernel /etc/default/flash-kernel
		;;
	triggered)
		FLASH_KERNEL_NOTRIGGER=y flash-kernel
		;;
	abort-upgrade|abort-remove|abort-deconfigure)
		;;
	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 1
		;;
esac

#DEBHELPER#