Annotation of /trunk/magellan-initscripts/rc/network
Parent Directory | Revision Log
Revision 20 -
(hide annotations)
(download)
Fri Dec 31 18:41:21 2004 UTC (19 years, 8 months ago) by niro
Original Path: trunk/magellan-initscripts/etc/rc.d/init.d/network
File size: 3070 byte(s)
Fri Dec 31 18:41:21 2004 UTC (19 years, 8 months ago) by niro
Original Path: trunk/magellan-initscripts/etc/rc.d/init.d/network
File size: 3070 byte(s)
fixed shutdown of the dhcp daemon
1 | niro | 2 | #!/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 | niro | 20 | source ${rc_functions} |
14 | niro | 2 | |
15 | checkconfig() { | ||
16 | niro | 20 | if [ -z "${NETWORKING}" ] |
17 | niro | 2 | then |
18 | echo "NETWORKING missing in net.${interface}, aborted" | ||
19 | exit 1 | ||
20 | fi | ||
21 | |||
22 | niro | 20 | case "${NETWORKING}" in |
23 | niro | 2 | static) |
24 | niro | 20 | if [ -z "${IP}" ] |
25 | niro | 2 | then |
26 | echo "IP missing in net.${interface}, aborted" | ||
27 | exit 1 | ||
28 | fi | ||
29 | |||
30 | niro | 20 | if [ -z "${NETMASK}" ] |
31 | niro | 2 | 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 | niro | 20 | if [ -z "${BROADCAST}" ] |
38 | niro | 2 | then |
39 | echo -n "BROADCAST missing in net.${interface}, " | ||
40 | echo "using default address" | ||
41 | fi | ||
42 | ;; | ||
43 | niro | 20 | |
44 | niro | 2 | dhcp) |
45 | niro | 20 | if [ -z "${DHCP_PROG}" ] |
46 | niro | 2 | then |
47 | echo "DHCP_PROG missing in net.${interface}, aborted" | ||
48 | exit 1 | ||
49 | fi | ||
50 | ;; | ||
51 | niro | 20 | |
52 | niro | 2 | esac |
53 | } | ||
54 | |||
55 | |||
56 | case "$1" in | ||
57 | start) | ||
58 | niro | 20 | for file in $(grep -il "ONBOOT=\"yes\"" ${network_settings}/net.*) |
59 | niro | 2 | do |
60 | niro | 20 | interface=$(basename ${file} | sed s/net.//) |
61 | case "${interface}" in | ||
62 | niro | 2 | *~) ;; |
63 | *) | ||
64 | niro | 20 | source ${network_settings}/net.${interface} || exit 1 |
65 | niro | 2 | checkconfig |
66 | niro | 20 | case "${NETWORKING}" in |
67 | niro | 2 | dhcp) |
68 | echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${interface}${COLDEFAULT} ..." | ||
69 | niro | 20 | ${CURS_UP} |
70 | ${SET_WWCOL} | ||
71 | niro | 2 | echo "[DHCP]" |
72 | niro | 20 | loadproc ${DHCP_PROG} ${DHCP_START} |
73 | niro | 2 | ;; |
74 | static) | ||
75 | echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${interface}${COLDEFAULT} ..." | ||
76 | niro | 20 | ${CURS_UP} |
77 | ${SET_WWCOL} | ||
78 | niro | 2 | echo "[STATIC]" |
79 | niro | 20 | ifconfig ${interface} ${IP} netmask ${NETMASK} broadcast ${BROADCAST} |
80 | niro | 2 | evaluate_retval |
81 | ;; | ||
82 | esac | ||
83 | ;; | ||
84 | esac | ||
85 | done | ||
86 | |||
87 | niro | 20 | if [ -n "${GATEWAY}" -a -n "${GATEWAY_IF}" ] |
88 | niro | 2 | then |
89 | echo -e ${COLOREDSTAR}"Setting up default gateway ..." | ||
90 | niro | 20 | route add default gateway ${GATEWAY} metric 1 \ |
91 | dev ${GATEWAY_IF} | ||
92 | niro | 2 | evaluate_retval |
93 | fi | ||
94 | |||
95 | update_svcstatus $1 | ||
96 | splash svc_started "$(basename $0)" 0 | ||
97 | ;; | ||
98 | |||
99 | stop) | ||
100 | niro | 20 | if [ -n "${GATEWAY}" ] |
101 | niro | 2 | then |
102 | echo -e ${COLOREDSTAR}"Removing default gateway ..." | ||
103 | route del -net default | ||
104 | evaluate_retval | ||
105 | fi | ||
106 | |||
107 | niro | 20 | for file in $(grep -il "ONBOOT=\"yes\"" ${network_settings}/net.*) |
108 | niro | 2 | do |
109 | niro | 20 | interface=$(basename ${file} | sed s/net.//) |
110 | case "${interface}" in | ||
111 | niro | 2 | *~) ;; |
112 | *) | ||
113 | #$network_devices/ifdown $interface | ||
114 | niro | 20 | source ${network_settings}/net.${interface} || exit 1 |
115 | niro | 2 | checkconfig |
116 | echo -e ${COLOREDSTAR}"Bringing down interface ${COLBLUE}${interface}${COLDEFAULT} ..." | ||
117 | niro | 20 | ifconfig ${interface} down |
118 | niro | 2 | evaluate_retval |
119 | |||
120 | #shutdown dhcp-daemon | ||
121 | niro | 20 | if [ "${NETWORKING}" == dhcp ] |
122 | niro | 2 | then |
123 | my_runlevel="`runlevel | cut -d ' ' -f2`" | ||
124 | niro | 20 | if [ -n "$(pidof ${DHCP_PROG})" ] |
125 | niro | 2 | then |
126 | echo -e ${COLOREDSTAR}"Stopping the dhcp-daemon ..." | ||
127 | niro | 20 | ${CURS_UP} |
128 | ${SET_WWCOL} | ||
129 | echo "[$(basename ${DHCP_PROG})]" | ||
130 | ${DHCP_PROG} ${DHCP_STOP} | ||
131 | niro | 2 | 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 | * |