Magellan Linux

Contents of /branches/unlabeled-1.1.1/magellan-initscripts/etc/rc.d/init.d/network

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Mon Dec 13 22:52:07 2004 UTC (19 years, 3 months ago) by niro
File size: 3035 byte(s)
imported.

1 #!/bin/bash
2
3 #%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k
4 #%start: 20
5 #%stop: 80
6
7 #deps
8 #%needs:
9 #%before:
10 #%after:
11
12 source /etc/sysconfig/rc
13 source $rc_functions
14
15 checkconfig() {
16 if [ -z $NETWORKING ]
17 then
18 echo "NETWORKING missing in net.${interface}, aborted"
19 exit 1
20 fi
21
22 case $NETWORKING in
23 static)
24 if [ -z $IP ]
25 then
26 echo "IP missing in net.${interface}, aborted"
27 exit 1
28 fi
29
30 if [ -z $NETMASK ]
31 then
32 echo -n "NETMASK missing in net.${interface}, "
33 echo "using 255.255.255.0"
34 NETMASK=255.255.255.0
35 fi
36
37 if [ -z $BROADCAST ]
38 then
39 echo -n "BROADCAST missing in net.${interface}, "
40 echo "using default address"
41 fi
42 ;;
43 dhcp)
44 if [ -z $DHCP_PROG ]
45 then
46 echo "DHCP_PROG missing in net.${interface}, aborted"
47 exit 1
48 fi
49 ;;
50 esac
51 }
52
53
54 case "$1" in
55 start)
56 for file in $(grep -il "ONBOOT=\"yes\"" $network_settings/net.*)
57 do
58 interface=$(basename $file | sed s/net.//)
59 case "$interface" in
60 *~) ;;
61 *)
62 #$network_devices/ifup $interface
63 source $network_settings/net.${interface} || exit 1
64 checkconfig
65 case $NETWORKING in
66 dhcp)
67 echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${interface}${COLDEFAULT} ..."
68 $CURS_UP
69 $SET_WWCOL
70 echo "[DHCP]"
71 #modprobe $interface
72 loadproc $DHCP_PROG $DHCP_START
73 ;;
74 static)
75 echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${interface}${COLDEFAULT} ..."
76 $CURS_UP
77 $SET_WWCOL
78 echo "[STATIC]"
79 ifconfig $interface $IP netmask $NETMASK broadcast $BROADCAST
80 evaluate_retval
81 ;;
82 esac
83 ;;
84 esac
85 done
86
87 if [ "$GATEWAY" != "" ]
88 then
89 echo -e ${COLOREDSTAR}"Setting up default gateway ..."
90 route add default gateway $GATEWAY metric 1 \
91 dev $GATEWAY_IF
92 evaluate_retval
93 fi
94
95 update_svcstatus $1
96 splash svc_started "$(basename $0)" 0
97 ;;
98
99 stop)
100 if [ "$GATEWAY" != "" ]
101 then
102 echo -e ${COLOREDSTAR}"Removing default gateway ..."
103 route del -net default
104 evaluate_retval
105 fi
106
107 for file in $(grep -il "ONBOOT=\"yes\"" $network_settings/net.*)
108 do
109 interface=$(basename $file | sed s/net.//)
110 case "$interface" in
111 *~) ;;
112 *)
113 #$network_devices/ifdown $interface
114 source $network_settings/net.${interface} || exit 1
115 checkconfig
116 echo -e ${COLOREDSTAR}"Bringing down interface ${COLBLUE}${interface}${COLDEFAULT} ..."
117 ifconfig eth0 down
118 evaluate_retval
119
120 #shutdown dhcp-daemon
121 if [ $NETWORKING == dhcp ]
122 then
123 my_runlevel="`runlevel | cut -d ' ' -f2`"
124 if [ "$my_runlevel" -ne "0" -a "$my_runlevel" -ne "6" ]
125 then
126 echo -e ${COLOREDSTAR}"Stopping the dhcp-daemon ..."
127 $CURS_UP
128 $SET_WWCOL
129 echo "[${DHCP_PROG}]"
130 $DHCP_PROG $DHCP_STOP
131 evaluate_retval
132 fi
133 fi
134 ;;
135 esac
136 done
137
138 update_svcstatus $1
139 splash svc_stopped "$(basename $0)" 0
140 ;;
141
142 restart)
143 $0 stop
144 sleep 1
145 $0 start
146 ;;
147
148 *)
149 echo "Usage: $0 {start|stop|restart}"
150 exit 1
151 ;;
152 esac

Properties

Name Value
svn:executable *