removed lfs-commands
[linux_from_scratch.git] / bootscripts / rc.d / init.d / network
blob655ad43f439b27f2d9d276d42b297f4d59337cf6
1 #!/bin/bash
2 # Begin $rc_base/init.d/network - Network Control Script
4 # Based on ethnet script from LFS-3.1 and earlier.
5 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
7 source /etc/sysconfig/rc
8 source $rc_functions
9 source /etc/sysconfig/network
11 case "$1" in
12 start)
13 for file in $(grep -il "ONBOOT=yes" $network_devices/ifconfig.*)
15 interface=$(basename $file | sed s/ifconfig.//)
16 case "$interface" in
17 *~) ;;
19 $network_devices/ifup $interface
21 esac
22 done
24 if [ "$GATEWAY" != "" ]
25 then
26 echo "Setting up default gateway..."
27 route add default gateway $GATEWAY metric 1 \
28 dev $GATEWAY_IF
29 evaluate_retval
33 stop)
34 if [ "$GATEWAY" != "" ]
35 then
36 echo "Removing default gateway..."
37 route del -net default
38 evaluate_retval
41 for file in $(grep -il "ONBOOT=yes" $network_devices/ifconfig.*)
43 interface=$(basename $file | sed s/ifconfig.//)
44 case "$interface" in
45 *~) ;;
47 $network_devices/ifdown $interface
49 esac
50 done
53 restart)
54 $0 stop
55 sleep 1
56 $0 start
60 echo "Usage: $0 {start|stop|restart}"
61 exit 1
63 esac
65 # End /etc/rc.d/init.d/network