Changeset 292c832 in bootscripts-embedded for clfs/rc.d/init.d/network
- Timestamp:
- Jan 30, 2011, 10:13:21 AM (14 years ago)
- Branches:
- master
- Children:
- 73ee2a6
- Parents:
- 5d96f6a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
clfs/rc.d/init.d/network
r5d96f6a r292c832 10 10 11 11 if [ "$NETWORKING" != "yes" ]; then 12 13 12 echo "Networking is disabled in /etc/network.conf" 13 exit 0 14 14 fi 15 15 16 16 case "$1" in 17 17 start) 18 for i in /etc/network.d/interface.*; do 19 if [ -r "$i" ]; then 20 . $i 21 if [ "$DHCP" = "yes" ]; then 22 echo -n "Starting DHCP for interface $INTERFACE: " 23 udhcpc -b -i "$INTERFACE" \ 24 -p "/var/run/udhcpc.$INTERFACE.pid" \ 25 > /dev/null 26 else 27 echo -n "Setting up interface $INTERFACE: " 28 ifconfig "$INTERFACE" "$IPADDRESS" \ 29 netmask "$NETMASK" \ 30 broadcast "$BROADCAST" up 31 fi 32 check_status 33 fi 34 done 18 for i in /etc/network.d/interface.* 19 do 20 if [ -r "$i" ]; then 21 . $i 22 if [ "$DHCP" = "yes" ]; then 23 echo -n "Starting DHCP for interface $INTERFACE: " 24 # udhcpc is braindead, bring up interface first 25 ifconfig "$INTERFACE" up 26 27 # Bridging code requires some time to wake up 28 [ "$INTERFACE" = "br0" ] && sleep 5 29 30 udhcpc -b -i "$INTERFACE" -s /etc/udhcpc.conf \ 31 -p "/var/run/udhcpc.$INTERFACE.pid" \ 32 > /dev/null 33 else 34 echo -n "Setting up interface $INTERFACE: " 35 ifconfig "$INTERFACE" "$IPADDRESS" \ 36 netmask "$NETMASK" \ 37 broadcast "$BROADCAST" up 38 fi 39 check_status 40 fi 41 done 35 42 36 37 38 39 40 41 ;;43 if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then 44 echo -n "Setting default route: " 45 route add default gw $GATEWAY 46 check_status 47 fi 48 ;; 42 49 stop) 43 44 45 46 47 50 if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then 51 echo -n "Removing default route: " 52 route del -net 0.0.0.0 53 check_status 54 fi 48 55 49 for i in /etc/network.d/interface.*; do 50 if [ -r "$i" ]; then 51 . $i 52 echo -n "Shutting down interface $INTERFACE: " 53 ifconfig $INTERFACE down 54 check_status 55 if [ "$DHCP" = "yes" ]; then 56 kill `cat "/var/run/udhcpc.$INTERFACE.pid"` 57 sleep 1 58 fi 59 fi 60 done 61 ;; 56 for i in /etc/network.d/interface.* 57 do 58 if [ -r "$i" ]; then 59 . $i 60 echo -n "Shutting down interface $INTERFACE: " 61 ifconfig $INTERFACE down 62 check_status 63 if [ "$DHCP" = "yes" ]; then 64 kill `cat "/var/run/udhcpc.$INTERFACE.pid"` 2>/dev/null || true 65 sleep 1 66 fi 67 fi 68 done 69 ;; 62 70 restart) 63 64 65 ;;71 $0 stop 72 $0 start 73 ;; 66 74 status) 67 68 69 ;;75 ifconfig 76 route 77 ;; 70 78 *) 71 72 79 echo "Usage: $0 {start|stop|restart|status}" 80 exit 1 73 81 esac
Note:
See TracChangeset
for help on using the changeset viewer.