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

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

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