Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2020 21:39:20 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361300 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <202005202139.04KLdKS0001937@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Wed May 20 21:39:19 2020
New Revision: 361300
URL: https://svnweb.freebsd.org/changeset/base/361300

Log:
  Fix indentation in bsdinstall-created wpa_supplicant.conf
  
  PR:		base/221982
  Reported by:	emaste
  Reviewed by:	emaste, allanjude
  MFC after:	0 days
  X-MFC-to:	stable/11
  Differential Revision:	https://reviews.freebsd.org/D23641

Modified:
  head/usr.sbin/bsdinstall/scripts/wlanconfig

Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/wlanconfig	Wed May 20 21:22:25 2020	(r361299)
+++ head/usr.sbin/bsdinstall/scripts/wlanconfig	Wed May 20 21:39:19 2020	(r361300)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
-# Copyright (c) 2013-2016 Devin Teske
+# Copyright (c) 2013-2020 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -60,8 +60,7 @@ country_set()
 		'wpa_supplicant -B -i "%s" -c "%s/wpa_supplicant.conf"' \
 		"$WLAN_IFACE" "$BSDINSTALL_TMPETC"
 	if [ "$error_str" ]; then
-		$DIALOG \
-			--title "$msg_error" \
+		$DIALOG --title "$msg_error" \
 			--backtitle "$DIALOG_BACKTITLE" \
 			--yes-label Change \
 			--no-label Ignore \
@@ -70,8 +69,7 @@ country_set()
 			0 0 || return $SUCCESS # Skip
 		return $FAILURE # Restart
 	else
-		awk 'sub(/^\t\t/,"")||1' \
-			> "$BSDINSTALL_TMPETC/rc.conf.net.wlan" <<-EOF
+		cat > "$BSDINSTALL_TMPETC/rc.conf.net.wlan" <<-EOF
 		create_args_$WLAN_IFACE="$ifconfig_args"
 		EOF
 	fi
@@ -101,7 +99,8 @@ dialog_country_select()
 		sub(/Country codes:/, ""), sub(/Regulatory.*/, "") {
 			while (match($0, /[[:upper:]][[:upper:][:digit:]] /)) {
 				country = substr($0, RSTART)
-				sub(/ [[:upper:]][[:upper:][:digit:]].*/, "", country)
+				sub(/ [[:upper:]][[:upper:][:digit:]].*/, "",
+					country)
 				code = substr(country, 1, 2)
 				desc = substr(country, 4)
 				sub(/[[:space:]]*$/, "", desc)
@@ -153,7 +152,7 @@ dialog_country_select()
 : > "$BSDINSTALL_TMPETC/wpa_supplicant.conf"
 chmod 0600 "$BSDINSTALL_TMPETC/wpa_supplicant.conf"
 
-cat >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" << EOF
+cat >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<EOF
 ctrl_interface=/var/run/wpa_supplicant
 eapol_version=2
 ap_scan=1
@@ -279,15 +278,15 @@ if echo "$ENCRYPTION" | grep -q PSK; then
 		"Password" 2 0 "" 2 12 15 63 1   \
 		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
 	) || exec "$0" "$@"
-	awk 'sub(/^\t/,"")||1' \
-		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<EOF
-network={
-	ssid="$NETWORK"
-	scan_ssid=$SCANSSID
-	psk="$PASS"
-	priority=5
-}
-EOF
+	awk 'sub(/^\\/,"")||1' \
+		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
+	network={
+	\	ssid="$NETWORK"
+	\	scan_ssid=$SCANSSID
+	\	psk="$PASS"
+	\	priority=5
+	}
+	EOF
 elif echo "$ENCRYPTION" | grep -q EAP; then
 	USERPASS=$( $DIALOG \
 		--title "WPA-Enterprise Setup"   \
@@ -300,19 +299,19 @@ elif echo "$ENCRYPTION" | grep -q EAP; then
 		"Password" 3 0 "" 3 12 25 63 1   \
 		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
 	) || exec "$0" "$@"
-	awk 'sub(/^\t/,"")||1' \
-		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<EOF
-network={
-	ssid="$NETWORK"
-	scan_ssid=$SCANSSID
-	key_mgmt=WPA-EAP$(
-	echo "$USERPASS" | awk '
-		NR == 1 { printf "\n\t\tidentity=\"%s\"", $1 }
-		NR == 2 { printf "\n\t\tpassword=\"%s\"", $1 }
-	' )
-	priority=5
-}
-EOF
+	awk 'sub(/^\\/,"")||1' \
+		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
+	network={
+	\	ssid="$NETWORK"
+	\	scan_ssid=$SCANSSID
+	\	key_mgmt=WPA-EAP$(
+		echo "$USERPASS" | awk '
+			NR == 1 { printf "\n\tidentity=\"%s\"", $1 }
+			NR == 2 { printf "\n\tpassword=\"%s\"", $1 }
+		' )
+	\	priority=5
+	}
+	EOF
 elif echo "$ENCRYPTION" | grep -q WEP; then
 	WEPKEY=$( $DIALOG \
 		--title "WEP Setup"              \
@@ -324,31 +323,31 @@ elif echo "$ENCRYPTION" | grep -q WEP; then
 		"WEP Key 0" 2 0 "" 2 12 15 0 1   \
 		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
 	) || exec "$0" "$@"
-	awk 'sub(/^\t/,"")||1' \
-		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<EOF
-network={
-	ssid="$NETWORK"
-	scan_ssid=$SCANSSID
-	key_mgmt=NONE
-	wep_key0="$WEPKEY"
-	wep_tx_keyidx=0
-	priority=5
-}
-EOF
+	awk 'sub(/^\\/,"")||1' \
+		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
+	network={
+	\	ssid="$NETWORK"
+	\	scan_ssid=$SCANSSID
+	\	key_mgmt=NONE
+	\	wep_key0="$WEPKEY"
+	\	wep_tx_keyidx=0
+	\	priority=5
+	}
+	EOF
 else # Open
-	awk 'sub(/^\t/,"")||1' \
-		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<EOF
-network={
-	ssid="$NETWORK"
-	scan_ssid=$SCANSSID
-	key_mgmt=NONE
-	priority=5
-}
-EOF
+	awk 'sub(/^\\/,"")||1' \
+		>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
+	network={
+	\	ssid="$NETWORK"
+	\	scan_ssid=$SCANSSID
+	\	key_mgmt=NONE
+	\	priority=5
+	}
+	EOF
 fi
 
 # Connect to any open networks policy
-cat >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" << EOF
+cat >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<EOF
 network={
 	priority=0
 	key_mgmt=NONE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005202139.04KLdKS0001937>