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