public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Evans" <grknight@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/livecd-tools:master commit in: /
Date: Tue, 10 Jan 2017 21:54:08 +0000 (UTC)	[thread overview]
Message-ID: <1478267943.4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac.grknight@gentoo> (raw)

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


             reply	other threads:[~2017-01-10 21:54 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 21:54 Brian Evans [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-09-26 17:07 [gentoo-commits] proj/livecd-tools:master commit in: / Rick Farina
2017-03-07 15:35 Brian Evans
2017-02-25  0:54 Robin H. Johnson
2015-10-18  2:26 William Hubbs
2015-10-18  1:45 Jorge Manuel B. S. Vicetto
2015-02-22 22:35 William Hubbs
2015-01-14 18:33 William Hubbs
2015-01-14  2:55 Jorge Manuel B. S. Vicetto
2013-07-07 22:48 William Hubbs
2013-07-07 22:28 William Hubbs
2013-07-06 23:53 William Hubbs
2013-02-25 18:20 William Hubbs
2013-02-25 17:48 William Hubbs
2013-02-25 17:48 William Hubbs
2011-06-30 20:31 William Hubbs
2011-06-28 19:56 William Hubbs
2011-06-28 17:32 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-05-01  2:49 William Hubbs
2011-02-17  5:38 William Hubbs
2011-02-10 21:30 William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478267943.4f58d313e461b9e9b38d3f6cae7ec5d5a0656cac.grknight@gentoo \
    --to=grknight@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox