1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.9 2005-10-10 18:43:03 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.10 2005-10-11 11:19:58 niro Exp $ |
3 |
|
|
4 |
#%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k |
#%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k |
5 |
#%start: 20 |
#%start: 20 |
141 |
return 1 |
return 1 |
142 |
fi |
fi |
143 |
|
|
144 |
|
${CURS_UP} |
145 |
|
${SET_WWCOL} |
146 |
|
echo "[AUTH: WEP]" |
147 |
|
|
148 |
iwconfig "${iface}" enc on |
iwconfig "${iface}" enc on |
149 |
[[ -n ${WIRELESS_KEY_LENGTH} ]] && iwconfig "${iface}" enc "${WIRELESS_KEY_LENGTH}" |
[[ -n ${WIRELESS_KEY_LENGTH} ]] && iwconfig "${iface}" enc "${WIRELESS_KEY_LENGTH}" |
150 |
[[ -n ${WIRELESS_KEY} ]] && iwconfig "${iface}" key "${WIRELESS_KEY}" |
[[ -n ${WIRELESS_KEY} ]] && iwconfig "${iface}" key "${WIRELESS_KEY}" |
167 |
return 1 |
return 1 |
168 |
fi |
fi |
169 |
|
|
170 |
|
${CURS_UP} |
171 |
|
${SET_WWCOL} |
172 |
|
echo "[AUTH: WPA]" |
173 |
|
|
174 |
# get default settings |
# get default settings |
175 |
[[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant |
[[ -f /etc/conf.d/wpa_supplicant ]] && source /etc/conf.d/wpa_supplicant |
176 |
|
|
202 |
-c"${WIRELESS_WPA_CONFIG}" \ |
-c"${WIRELESS_WPA_CONFIG}" \ |
203 |
-i"${iface}" \ |
-i"${iface}" \ |
204 |
${WIRELESS_WPA_OPTS} |
${WIRELESS_WPA_OPTS} |
205 |
|
|
206 |
|
# echo wait 5 seconds |
207 |
|
echo " Waiting 5 seconds to retrieve authentification reply ... " |
208 |
|
sleep 5 |
209 |
} |
} |
210 |
|
|
211 |
setup_wireless_extensions() |
setup_wireless_extensions() |
218 |
return 1 |
return 1 |
219 |
fi |
fi |
220 |
|
|
221 |
|
echo -e ${COLOREDSTAR}"Setting up wlan-ext for ${COLBLUE}${iface}${COLDEFAULT} ... " |
222 |
|
|
223 |
[[ -n ${WIRELESS_BITRATE} ]] && iwconfig "${iface}" rate "${WIRELESS_BITRATE}" |
[[ -n ${WIRELESS_BITRATE} ]] && iwconfig "${iface}" rate "${WIRELESS_BITRATE}" |
224 |
[[ -n ${WIRELESS_CHANNEL} ]] && iwconfig "${iface}" channel "${WIRELESS_CHANNEL}" |
[[ -n ${WIRELESS_CHANNEL} ]] && iwconfig "${iface}" channel "${WIRELESS_CHANNEL}" |
225 |
[[ -n ${WIRELESS_ESSID} ]] && iwconfig "${iface}" essid "${WIRELESS_ESSID}" |
[[ -n ${WIRELESS_ESSID} ]] && iwconfig "${iface}" essid "${WIRELESS_ESSID}" |
245 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || exit 1 |
246 |
checkconfig |
checkconfig |
247 |
|
|
|
echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..." |
|
|
|
|
248 |
# setup mac |
# setup mac |
249 |
[ -n "${FORCE_MAC_TO}" ] && ifconfig ${iface} hw ether "${FORCE_MAC_TO}" |
if [ -n "${FORCE_MAC_TO}" ] |
250 |
|
then |
251 |
|
echo -e ${COLOREDSTAR}"Faking MAC to ${FORCE_MAC_TO} for ${COLBLUE}${iface}${COLDEFAULT} ... " |
252 |
|
ifconfig "${iface}" hw ether "${FORCE_MAC_TO}" |
253 |
|
evaluate_retval |
254 |
|
fi |
255 |
|
|
256 |
|
# activate the interface |
257 |
|
ifconfig "${iface}" up |
258 |
|
|
259 |
|
# now configure wireless_extensions |
260 |
|
[ -x /usr/sbin/iwconfig ] && setup_wireless_extensions "${iface}" |
261 |
|
|
262 |
|
echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${iface}${COLDEFAULT} ..." |
263 |
|
|
264 |
# setup static or dhcp |
# setup static or dhcp |
265 |
case ${NETWORKING} in |
case ${NETWORKING} in |
298 |
echo "nameserver ${dns}" >> /etc/resolv.conf |
echo "nameserver ${dns}" >> /etc/resolv.conf |
299 |
done |
done |
300 |
fi |
fi |
|
|
|
|
# setup wlan extensions |
|
|
if [ -x /usr/sbin/iwconfig ] |
|
|
then |
|
|
setup_wireless_extensions "${iface}" |
|
|
fi |
|
301 |
done |
done |
302 |
} |
} |
303 |
|
|
327 |
${CURS_UP} |
${CURS_UP} |
328 |
${SET_WWCOL} |
${SET_WWCOL} |
329 |
echo "[$(basename ${DHCP_PROG})]" |
echo "[$(basename ${DHCP_PROG})]" |
330 |
${DHCP_PROG} ${DHCP_STOP} |
${DHCP_PROG} ${DHCP_STOP} "${iface}" |
331 |
evaluate_retval |
evaluate_retval |
332 |
fi |
fi |
333 |
|
|
337 |
killall wpa_supplicant |
killall wpa_supplicant |
338 |
fi |
fi |
339 |
done |
done |
340 |
|
|
341 |
|
# remove state dir |
342 |
|
if [ -d /var/run/wpa_supplicant ] |
343 |
|
then |
344 |
|
rm -rf /var/run/wpa_supplicant |
345 |
|
fi |
346 |
} |
} |
347 |
|
|
348 |
case $1 in |
case $1 in |