File: network.sh

package info (click to toggle)
kickseed 0.64
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 304 kB
  • sloc: sh: 1,709; makefile: 2
file content (68 lines) | stat: -rw-r--r-- 1,523 bytes parent folder | download | duplicates (4)
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
61
62
63
64
65
66
67
68
#! /bin/sh

network_handler () {
	got_ipaddress=
	got_gateway=
	got_nameservers=
	got_netmask=
	eval set -- "$(getopt -o '' -l bootproto:,device:,ip:,gateway:,nameserver:,nodns,netmask:,hostname: -- "$@")" || { warn_getopt network; return; }
	while :; do
		case $1 in
			--bootproto)
				case $2 in
					dhcp|bootp)
						;;
					static)
						ks_preseed d-i netcfg/disable_autoconfig boolean true
						;;
					*)
						warn_bad_arg network bootproto "$2"
						;;
				esac
				shift 2
				;;
			--device)
				ks_preseed d-i netcfg/choose_interface 'select' "$2"
				shift 2
				;;
			--ip)
				ks_preseed d-i netcfg/get_ipaddress string "$2"
				got_ipaddress=1
				shift 2
				;;
			--gateway)
				ks_preseed d-i netcfg/get_gateway string "$2"
				got_gateway=1
				shift 2
				;;
			--nameserver)
				ks_preseed d-i netcfg/get_nameservers string "$2"
				got_nameservers=1
				shift 2
				;;
			--nodns)
				ks_preseed d-i netcfg/get_nameservers string ''
				got_nameservers=1
				shift
				;;
			--netmask)
				ks_preseed d-i netcfg/get_netmask string "$2"
				got_netmask=1
				shift 2
				;;
			--hostname)
				ks_preseed d-i netcfg/get_hostname string "$2"
				shift 2
				;;
			--)	shift; break ;;
			*)	warn_getopt network; return ;;
		esac
	done

	# If all the information displayed on the netcfg/confirm_static
	# screen was preseeded, skip it.
	if [ "$got_ipaddress" ] && [ "$got_netmask" ] && \
	   [ "$got_gateway" ] && [ "$got_nameservers" ]; then
		ks_preseed d-i netcfg/confirm_static boolean true
	fi
}