summaryrefslogtreecommitdiffstats
path: root/src.etc/init.d/networking
blob: 25714c16d1103521547f25fb875701267048fa3c (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'
	exec 3>/etc/network/interfaces
	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
}