File: net

package info (click to toggle)
kickseed 0.55
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 300 kB
  • ctags: 75
  • sloc: sh: 1,699; makefile: 2
file content (53 lines) | stat: -rwxr-xr-x 1,608 bytes parent folder | download | duplicates (2)
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 -e
# Bring up everything that's needed to fetch a Kickstart file from the
# network.

# without this, debconf clients will talk debconf protocol to syslog
. /usr/share/debconf/confmodule

. /lib/kickseed/cmdline.sh

EXTRA_UDEBS="$@"

if [ ! -x /var/lib/dpkg/info/ethdetect.postinst ] || \
   [ ! -x /var/lib/dpkg/info/netcfg.postinst ]; then
	/lib/kickseed/kickseed-anna ethdetect netcfg $EXTRA_UDEBS
fi

if [ -x /var/lib/dpkg/info/ethdetect.postinst ]; then
	/lib/kickseed/kickseed-udpkg ethdetect
else
	logger -t kickseed "ethdetect cannot be installed"
	exit 1
fi

set_question () {
	if ! db_fget "$1" seen || [ "$RET" = false ]; then
		db_register debian-installer/dummy "$1"
		if [ "$2" ]; then
			db_set "$1" "$2"
		fi
		db_fset "$1" seen true
	fi
}

if [ -x /var/lib/dpkg/info/netcfg.postinst ]; then
	# Make sure we don't get asked unnecessary networking questions.
	# Do tell the user about errors, though.
	KSDEVICE="$(kickseed_cmdline /proc/cmdline ksdevice)"
	if [ -z "$KSDEVICE" ] || [ "$KSDEVICE" = link ]; then
		KSDEVICE=auto
	elif [ "$KSDEVICE" = bootif ]; then
		logger -t kickseed "ksdevice=bootif not supported yet; defaulting to first available interface"
		KSDEVICE=auto
	fi
	set_question netcfg/choose_interface "$KSDEVICE"
	set_question netcfg/get_hostname kickseed
	set_question netcfg/wireless_essid
	set_question netcfg/wireless_essid_again
	set_question netcfg/wireless_wep

	# Run the postinst by hand so that main-menu will run netcfg again
	# later, possibly with different preseeded answers.
	/var/lib/dpkg/info/netcfg.postinst configure 2>&1 | logger -t netcfg
fi