diff options
author | Brian Evans <grknight@gentoo.org> | 2016-11-04 09:27:55 -0400 |
---|---|---|
committer | Brian Evans <grknight@gentoo.org> | 2016-11-04 09:59:03 -0400 |
commit | 4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac (patch) | |
tree | 49c10775a9c897e3bb8ce2cf89d9340c7aa8352e /net-setup | |
parent | convert shebangs from runscript to openrc-run (diff) | |
download | livecd-tools-4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac.tar.gz livecd-tools-4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac.tar.bz2 livecd-tools-4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac.zip |
net-setup: add WPA{,2}-PSK setup option
Diffstat (limited to 'net-setup')
-rwxr-xr-x | net-setup | 44 |
1 files changed, 40 insertions, 4 deletions
@@ -188,6 +188,24 @@ config_wireless() { fi } +config_wpa() { + cd /tmp/setup.opts + dialog --visit-items --title "SSID" \ + --inputbox "Please enter your SSID" \ + 20 50 2> ${iface}.SSID + SSID=$(tail -n 1 ${iface}.SSID) + dialog --visit-items --title "WPA(2)-PSK" \ + --inputbox "Please enter your WPA Preshared key in ASCII form. This should be between 8 and 63 characters" \ + 20 50 2> ${iface}.WPAKEY + WPA_KEY=$(tail -n 1 ${iface}.WPAKEY) + if [ -n "${WPA_KEY}" ] + then + mkdir -p /etc/wpa_supplicant + wpa_passphrase "${SSID}" "${WPA_KEY}" > /etc/wpa_supplicant/wpa_supplicant.conf + wpa_supplicant -B -i${iface} -c /etc/wpa_supplicant/wpa_supplicant.conf -Dnl80211,wext + fi +} + config_ip() { cd /tmp/setup.opts dialog --visit-items --title "TCP/IP setup" \ @@ -310,10 +328,22 @@ write_wireless_conf() { fi } +write_wpa_conf() { + cd /tmp/setup.opts + SSID=$(tail -n 1 ${iface}.SSID) + if [ -n "${SSID}" ] + then + echo "" >> /etc/conf.d/net + echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/net + echo "modules_${iface}=\"wpa_supplicant\"" >> /etc/conf.d/net + echo "wpa_supplicant_${iface}=\"-Dnl80211,wext\"" >> /etc/conf.d/net + fi +} + write_net_conf() { cd /tmp/setup.opts - echo "" > /etc/conf.d/net - echo "# This network configuration was written by net-setup" > /etc/conf.d/net + echo "" >> /etc/conf.d/net + echo "# This network configuration was written by net-setup" >> /etc/conf.d/net DHCP=$(tail -n 1 ${iface}.DHCP) case ${DHCP} in 1) @@ -367,16 +397,22 @@ done dialog --visit-items --title "Network setup" \ --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:" \ - 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${iface}.WIRED_WIRELESS + 20 60 7 1 "My network is wired" 2 "My network is wireless (Open/WEP)" \ + 3 "My network is wireless (WPA-PSK/WPA2-PSK)" 2> ${iface}.WIRED_WIRELESS WIRED_WIRELESS=$(tail -n 1 ${iface}.WIRED_WIRELESS) case ${WIRED_WIRELESS} in 1) + config_ip + ;; + 2) config_wireless config_ip write_wireless_conf ;; - 2) + 3) + config_wpa config_ip + write_wpa_conf ;; esac write_net_conf |