1#!/bin/sh 2#- 3# Copyright (c) 2011 Nathan Whitehorn |
4# Copyright (c) 2013 Devin Teske |
5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27# |
28# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/wlanconfig 258421 2013-11-21 03:40:52Z dteske $ 29# 30############################################################ INCLUDES |
31 |
32BSDCFG_SHARE="/usr/share/bsdconfig" 33. $BSDCFG_SHARE/common.subr || exit 1 34 35############################################################ MAIN 36 |
37echo -n > $BSDINSTALL_TMPETC/wpa_supplicant.conf 38chmod 0600 $BSDINSTALL_TMPETC/wpa_supplicant.conf 39 40echo "ctrl_interface=/var/run/wpa_supplicant" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf 41echo "eapol_version=2" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf 42echo "ap_scan=1" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf 43echo "fast_reauth=1" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf 44echo >> $BSDINSTALL_TMPETC/wpa_supplicant.conf --- 8 unchanged lines hidden (view full) --- 53# See if we succeeded 54wpa_cli ping >/dev/null 2>/dev/null 55if [ $? -ne 0 -a -z $BSDINSTALL_CONFIGCURRENT ]; then 56 dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox \ 57 "Wireless cannot be configured without making changes to the local system!" \ 0 0 58 exit 1 59fi 60 |
61output=$( wpa_cli scan 2>&1 ) 62f_dprintf "%s" "$output" |
63dialog --backtitle "FreeBSD Installer" --title "Scanning" --ok-label "Skip" \ 64 --pause "Waiting 5 seconds to scan for wireless networks..." \ 65 9 40 5 || exit 1 66 67SCAN_RESULTS=`wpa_cli scan_results` 68NETWORKS=`echo "$SCAN_RESULTS" | awk -F '\t' \ 69 '/..:..:..:..:..:../ {if (length($5) > 0) printf("\"%s\"\t%s\n", $5, $4);}' | 70 sort | uniq` --- 65 unchanged lines hidden (view full) --- 136 137# Connect to any open networks policy 138echo "network={ 139 priority=5 140 key_mgmt=NONE 141}" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf 142 143# Bring up new network |
144if [ "$BSDINSTALL_CONFIGCURRENT" ]; then 145 output=$( wpa_cli reconfigure 2>&1 ) 146 f_dprintf "%s" "$output" 147fi |
148 149exit 0 |
150 151################################################################################ 152# END 153################################################################################ |