Lines 188-193
config_wireless() {
Link Here
|
188 |
fi |
188 |
fi |
189 |
} |
189 |
} |
190 |
|
190 |
|
|
|
191 |
config_wpa() { |
192 |
cd /tmp/setup.opts |
193 |
dialog --visit-items --title "SSID" \ |
194 |
--inputbox "Please enter your SSID" \ |
195 |
20 50 2> ${iface}.SSID |
196 |
SSID=$(tail -n 1 ${iface}.SSID) |
197 |
dialog --visit-items --title "WPA(2)-PSK" \ |
198 |
--inputbox "Please enter your WPA Preshared key in ASCII form. This should be between 8 and 63 characters" \ |
199 |
20 50 2> ${iface}.WPAKEY |
200 |
WPA_KEY=$(tail -n 1 ${iface}.WPAKEY) |
201 |
if [ -n "${WPA_KEY}" ] |
202 |
then |
203 |
mkdir -p /etc/wpa_supplicant |
204 |
wpa_passphrase "${SSID}" "${WPA_KEY}" > /etc/wpa_supplicant/wpa_supplicant.conf |
205 |
wpa_supplicant -B -i${iface} -c /etc/wpa_supplicant/wpa_supplicant.conf -Dnl80211,wext |
206 |
fi |
207 |
} |
208 |
|
191 |
config_ip() { |
209 |
config_ip() { |
192 |
cd /tmp/setup.opts |
210 |
cd /tmp/setup.opts |
193 |
dialog --visit-items --title "TCP/IP setup" \ |
211 |
dialog --visit-items --title "TCP/IP setup" \ |
Lines 279-288
write_wireless_conf() {
Link Here
|
279 |
fi |
297 |
fi |
280 |
} |
298 |
} |
281 |
|
299 |
|
|
|
300 |
write_wpa_conf() { |
301 |
cd /tmp/setup.opts |
302 |
SSID=$(tail -n 1 ${iface}.SSID) |
303 |
if [ -n "${SSID}" ] |
304 |
then |
305 |
echo "" >> /etc/conf.d/net |
306 |
echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/net |
307 |
echo "modules_${iface}=\"wpa_supplicant\"" >> /etc/conf.d/net |
308 |
echo "wpa_supplicant_${iface}=\"-Dnl80211,wext\"" >> /etc/conf.d/net |
309 |
fi |
310 |
} |
311 |
|
282 |
write_net_conf() { |
312 |
write_net_conf() { |
283 |
cd /tmp/setup.opts |
313 |
cd /tmp/setup.opts |
284 |
echo "" > /etc/conf.d/net |
314 |
echo "" >> /etc/conf.d/net |
285 |
echo "# This network configuration was written by net-setup" > /etc/conf.d/net |
315 |
echo "# This network configuration was written by net-setup" >> /etc/conf.d/net |
286 |
DHCP=$(tail -n 1 ${iface}.DHCP) |
316 |
DHCP=$(tail -n 1 ${iface}.DHCP) |
287 |
case ${DHCP} in |
317 |
case ${DHCP} in |
288 |
1) |
318 |
1) |
Lines 336-351
done
Link Here
|
336 |
|
366 |
|
337 |
dialog --visit-items --title "Network setup" \ |
367 |
dialog --visit-items --title "Network setup" \ |
338 |
--menu "This script is designed to setup both wired and wireless network settings. All questions below apply to the ${iface} interface only. Choose one option:" \ |
368 |
--menu "This script is designed to setup both wired and wireless network settings. All questions below apply to the ${iface} interface only. Choose one option:" \ |
339 |
20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${iface}.WIRED_WIRELESS |
369 |
20 60 7 1 "My network is wired" 2 "My network is wireless (Open/WEP)" \ |
|
|
370 |
3 "My network is wireless (WPA-PSK/WPA2-PSK)" 2> ${iface}.WIRED_WIRELESS |
340 |
WIRED_WIRELESS=$(tail -n 1 ${iface}.WIRED_WIRELESS) |
371 |
WIRED_WIRELESS=$(tail -n 1 ${iface}.WIRED_WIRELESS) |
341 |
case ${WIRED_WIRELESS} in |
372 |
case ${WIRED_WIRELESS} in |
342 |
1) |
373 |
1) |
|
|
374 |
config_ip |
375 |
;; |
376 |
2) |
343 |
config_wireless |
377 |
config_wireless |
344 |
config_ip |
378 |
config_ip |
345 |
write_wireless_conf |
379 |
write_wireless_conf |
346 |
;; |
380 |
;; |
347 |
2) |
381 |
3) |
|
|
382 |
config_wpa |
348 |
config_ip |
383 |
config_ip |
|
|
384 |
write_wpa_conf |
349 |
;; |
385 |
;; |
350 |
esac |
386 |
esac |
351 |
write_net_conf |
387 |
write_net_conf |