File: auto-install.postinst

package info (click to toggle)
auto-install 1.9
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 60 kB
  • sloc: sh: 48; makefile: 2
file content (53 lines) | stat: -rwxr-xr-x 1,041 bytes parent folder | download
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
#!/bin/sh

set -e

. /usr/share/debconf/confmodule
. /lib/preseed/preseed.sh

# Install ai-choosers
pinst=
for p in localechooser kbd-chooser console-setup-udeb; do
	if [ -e /var/lib/dpkg/info/$p.postinst ]; then
		pinst="$pinst ai-$p"
	fi
done
[ -z "$pinst" ] || anna-install $pinst || true

if [ -e /var/run/preseed_unspecified_at_boot ] ; then
	if [ -n "$(dhcp_preseed_url)" ]; then
		rm /var/run/preseed_unspecified_at_boot
	else
		db_input critical preseed/url || true
		db_go || true
	fi
fi

db_get preseed/url && url="$RET"
[ "$url" ] || exit 0

if [ "${url%%://*}" != "$url" ]; then
	proto="${url%%://*}"
	base="${url#*://}"
else
	proto=http
	base="$url"
fi

if ! expr "$base" : [^/]*$ >/dev/null; then
	host="${base%%/*}"
	dir="${base#*/}"
else
	host="$base"
	db_get auto-install/defaultroot && dir="$RET"
fi

if expr $host : [^.]*$ >/dev/null; then
	db_get netcfg/get_domain && domain="$RET"

	if [ -n "$domain" ] && [ "$domain" != "unnassigned-domain" ]; then
		host="$host.$domain"
	fi
fi

db_set preseed/url $proto://$host/$dir