~ubuntu-branches/ubuntu/trusty/debian-installer-utils/trusty-proposed

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
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh -e

. /usr/share/debconf/confmodule

TITLE_TEMPLATE="$1"
shift
COMMAND_LINE="$@"

have_terminal_plugin () {
	db_capb
	set -- $RET
	for cap; do
		if [ "$cap" = plugin-terminal ]; then
			return 0
		fi
	done
	return 1
}

show_unavailable_message () {
	local workaround_template

	workaround_template=debian-installer/workaround-$DEBIAN_FRONTEND
	if ! db_metaget $workaround_template description; then
		RET=""
	fi
	db_subst debian-installer/terminal-plugin-unavailable WORKAROUND "$RET"
	db_fset debian-installer/terminal-plugin-unavailable seen false
	db_input critical debian-installer/terminal-plugin-unavailable
	db_go || true
	db_capb backup
}

case $DEBIAN_FRONTEND in
    text)
	debconf-disconnect $COMMAND_LINE || true
	;;
    *)
	if ! have_terminal_plugin; then
		anna-install cdebconf-$DEBIAN_FRONTEND-terminal || true
		if ! have_terminal_plugin; then
			if [ "$DEBIAN_FRONTEND" = newt ]; then
				debconf-disconnect $COMMAND_LINE || true
				exit 0
			fi
			show_unavailable_message
			exit 1
		fi
	fi
	if ! db_metaget $TITLE_TEMPLATE description; then
		db_metaget debian-installer/shell-plugin-default-title description
	fi
	db_subst debian-installer/shell-plugin TITLE "$RET"
	db_subst debian-installer/shell-plugin COMMAND_LINE $COMMAND_LINE
	db_fset debian-installer/shell-plugin seen false
	db_input critical debian-installer/shell-plugin
	db_go || true
	db_capb backup
	;;
esac