blob: c650fbce94e0cc769b4eec90bf4c30d2e7198f21 (
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
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
|
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
ck_daemon network || exit
stat_busy "Starting Network"
for ifline in ${INTERFACES[@]}; do
if echo $ifline | grep '^[^\!]' 2>&1 > /dev/null; then
varname="\$${ifline}"
eval new_ifline=$varname
if [ "$new_ifline" = "dhcp" ]; then
/usr/sbin/dhcpcd $ifline || stat_die
else
/sbin/ifconfig $new_ifline || stat_die
fi
fi
done
for rtline in "${ROUTES[@]}"; do
if echo $rtline | grep '^[^\!]' 2>&1 > /dev/null; then
varname="\$${rtline}"
eval new_rtline=$varname
/sbin/route add $new_rtline || stat_die
fi
done
add_daemon network
stat_done
;;
stop)
ck_daemon network && exit
stat_busy "Stopping Network"
rm_daemon network
for rtline in "${ROUTES[@]}"; do
if echo $rtline | grep '^[^\!]' 2>&1 > /dev/null; then
varname="\$${rtline}"
eval new_rtline=$varname
/sbin/route del $new_rtline || stat_die
fi
done
for ifline in ${INTERFACES[@]}; do
if echo $ifline | grep '^[^\!]' 2>&1 > /dev/null; then
varname="\$${ifline}"
eval new_ifline=$varname
if [ "$new_ifline" = "dhcp" ]; then
# do nothing - we kill dhcpcd later
/bin/true
else
/sbin/ifconfig $new_ifline down || stat_die
fi
fi
done
/usr/bin/killall -q dhcpcd
stat_done
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
|