From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-922426-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 43522139085 for <garchives@archives.gentoo.org>; Tue, 10 Jan 2017 21:54:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78CC223411E; Tue, 10 Jan 2017 21:54:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 425F823411E for <gentoo-commits@lists.gentoo.org>; Tue, 10 Jan 2017 21:54:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3CB56341142 for <gentoo-commits@lists.gentoo.org>; Tue, 10 Jan 2017 21:54:10 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A73FF24E5 for <gentoo-commits@lists.gentoo.org>; Tue, 10 Jan 2017 21:54:08 +0000 (UTC) From: "Brian Evans" <grknight@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Evans" <grknight@gentoo.org> Message-ID: <1478267943.4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac.grknight@gentoo> Subject: [gentoo-commits] proj/livecd-tools:master commit in: / X-VCS-Repository: proj/livecd-tools X-VCS-Files: net-setup X-VCS-Directories: / X-VCS-Committer: grknight X-VCS-Committer-Name: Brian Evans X-VCS-Revision: 4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac X-VCS-Branch: master Date: Tue, 10 Jan 2017 21:54:08 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5e37ceee-aa6e-44f4-bb3c-fcac7a052c81 X-Archives-Hash: f085861e6d2a47ca9f86c014a328b0bb commit: 4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac Author: Brian Evans <grknight <AT> gentoo <DOT> org> AuthorDate: Fri Nov 4 13:27:55 2016 +0000 Commit: Brian Evans <grknight <AT> gentoo <DOT> org> CommitDate: Fri Nov 4 13:59:03 2016 +0000 URL: https://gitweb.gentoo.org/proj/livecd-tools.git/commit/?id=4f58d313 net-setup: add WPA{,2}-PSK setup option net-setup | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/net-setup b/net-setup index 78625f7..d47628b 100755 --- a/net-setup +++ b/net-setup @@ -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