summaryrefslogtreecommitdiffstats
path: root/src.etc/init.d/networking
blob: 274346fa36001e314efdc638e4d5c9e720e53f52 (plain)
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
#!/bin/sh /etc/rc.common

start()
{
	log 'Configuring network interfaces'
	exec 3>/etc/network/interfaces
	printf '# GENERATED FILE.  DO NO EDIT.\n' >&3
	printf '# Edit /etc/network/interfaces.local instead.\n\n' >&3
	printf 'auto lo\niface lo inet loopback\n\n' >&3
	for iface in /sys/class/net/eth*; do
		iface="${iface##*/}"
		[ "x${iface}" = 'xeth*' ] && continue
		printf 'auto %s\niface %s inet dhcp\n\n' \
			"${iface}" "${iface}" >&3
	done
	exec 3>&-
	if [ -e /etc/network/interfaces.local ]; then
		file=/etc/network/interfaces.local
	else
		file=/etc/network/interfaces
	fi
	ifup -a -i "${file}"
	cp "${file}" /var/run/net-ifaces
}

stop()
{
	log 'Deconfiguring network interfaces'
	ifdown -a -i /var/run/net-ifaces
}