Whitespace (dialog options separated to minimize diffs)

This commit is contained in:
dteske 2016-12-12 20:41:27 +00:00
parent b7278ffafc
commit f36072e86a

View File

@ -60,9 +60,14 @@ country_set()
"$BSDINSTALL_TMPETC/wpa_supplicant.conf" "$BSDINSTALL_TMPETC/wpa_supplicant.conf"
fi fi
if [ "$error_str" ]; then if [ "$error_str" ]; then
dialog --backtitle "$DIALOG_BACKTITLE" --title "Error" \ dialog \
--yes-label Change --no-label Ignore --yesno \ --backtitle "$DIALOG_BACKTITLE" \
"Error while applying chosen settings ($error_str)" 0 0 --title "Error" \
--yes-label Change \
--no-label Ignore \
--yesno \
"Error while applying chosen settings ($error_str)" \
0 0
if [ $? -eq $DIALOG_OK ]; then if [ $? -eq $DIALOG_OK ]; then
return $FAILURE # Restart return $FAILURE # Restart
else else
@ -158,8 +163,11 @@ EOF
# See if we succeeded # See if we succeeded
wpa_cli ping >/dev/null 2>/dev/null wpa_cli ping >/dev/null 2>/dev/null
if [ $? -ne 0 -a ! "$BSDINSTALL_CONFIGCURRENT" ]; then if [ $? -ne 0 -a ! "$BSDINSTALL_CONFIGCURRENT" ]; then
dialog --backtitle "$DIALOG_BACKTITLE" --title "Error" --msgbox \ dialog \
"Wireless cannot be configured without making changes to the local system!" \ 0 0 --backtitle "$DIALOG_BACKTITLE" \
--title "Error" \
--msgbox "Wireless cannot be configured without making changes to the local system!" \
0 0
exit 1 exit 1
fi fi
@ -175,9 +183,11 @@ if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
DEF_COUNTRY=$( echo $INPUT | cut -w -f 4 ) DEF_COUNTRY=$( echo $INPUT | cut -w -f 4 )
[ "$DEF_REGDOMAIN" = 0 ] && DEF_REGDOMAIN="<not selected>" [ "$DEF_REGDOMAIN" = 0 ] && DEF_REGDOMAIN="<not selected>"
[ "$DEF_COUNTRY" = 0 ] && DEF_COUNTRY="<not selected>" [ "$DEF_COUNTRY" = 0 ] && DEF_COUNTRY="<not selected>"
dialog --backtitle "$DIALOG_BACKTITLE" --title "Regdomain/country" \ dialog \
--yesno "Change regdomain/country (now \ --backtitle "$DIALOG_BACKTITLE" \
$DEF_REGDOMAIN/$DEF_COUNTRY)?" 0 0 --title "Regdomain/country" \
--yesno "Change regdomain/country (now $DEF_REGDOMAIN/$DEF_COUNTRY)?" \
0 0
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
while : while :
do do
@ -193,28 +203,41 @@ while :; do
SCANSSID=0 SCANSSID=0
output=$( wpa_cli scan 2>&1 ) output=$( wpa_cli scan 2>&1 )
f_dprintf "%s" "$output" f_dprintf "%s" "$output"
dialog --backtitle "$DIALOG_BACKTITLE" --title "Scanning" \ dialog \
--ok-label "Skip" \ --backtitle "$DIALOG_BACKTITLE" \
--pause "Waiting 5 seconds to scan for wireless networks..." \ --title "Scanning" \
9 40 5 || exit 1 --ok-label "Skip" \
--pause "Waiting 5 seconds to scan for wireless networks..." \
9 40 5 || exit 1
SCAN_RESULTS=$( wpa_cli scan_results ) SCAN_RESULTS=$( wpa_cli scan_results )
NETWORKS=$( echo "$SCAN_RESULTS" | awk -F '\t' \ NETWORKS=$( echo "$SCAN_RESULTS" | awk -F '\t' '
'/..:..:..:..:..:../ {if (length($5) > 0) \ /..:..:..:..:..:../ {
printf("\"%s\"\t%s\n", $5, $4);}' | sort | uniq ) if (length($5) > 0)
printf("\"%s\"\t%s\n", $5, $4);
}
' | sort | uniq )
if [ ! "$NETWORKS" ]; then if [ ! "$NETWORKS" ]; then
dialog --backtitle "$DIALOG_BACKTITLE" --title "Error" \ dialog \
--yesno "No wireless networks were found. Rescan?" 0 0 && --backtitle "$DIALOG_BACKTITLE" \
continue --title "Error" \
--yesno "No wireless networks were found. Rescan?" \
0 0 && continue
exit 1 exit 1
fi fi
exec 3>&1 exec 3>&1
NETWORK=$( sh -c "dialog --extra-button --extra-label \"Rescan\" \ NETWORK=$( sh -c "dialog \
--backtitle \"$DIALOG_BACKTITLE\" --title \"Network Selection\" \ --extra-button \
--menu \"Select a wireless network to connect to.\" 0 0 0 \ --extra-label \"Rescan\" \
$(echo $NETWORKS | tr '\n' ' ')" 2>&1 1>&3 ) --backtitle \"$DIALOG_BACKTITLE\" \
--title \"Network Selection\" \
--menu \"Select a wireless network to connect to.\" \
0 0 0 \
$( echo $NETWORKS | tr '\n' ' ' )" \
2>&1 1>&3
)
case $? in case $? in
$DIALOG_OK) $DIALOG_OK)
break break
@ -224,9 +247,17 @@ while :; do
f_dialog_title "Network Selection" f_dialog_title "Network Selection"
f_dialog_yesno "Do you want to select the network manually?" || exit 1 f_dialog_yesno "Do you want to select the network manually?" || exit 1
f_dialog_input NETWORK "Enter SSID" || exit 1 f_dialog_input NETWORK "Enter SSID" || exit 1
ENCRYPTION=$( dialog --backtitle "$DIALOG_BACKTITLE" --title \ ENCRYPTION=$( dialog \
"$DIALOG_TITLE" --menu "Select encryption type" 0 0 0 \ --backtitle "$DIALOG_BACKTITLE" \
"1 WPA/WPA2 PSK" "" "2 WPA/WPA2 EAP" "" "3 WEP" "" "0 None" "" 2>&1 1>&3 ) || exit 1 --title "$DIALOG_TITLE" \
--menu "Select encryption type" \
0 0 0 \
"1 WPA/WPA2 PSK" "" \
"2 WPA/WPA2 EAP" "" \
"3 WEP" "" \
"0 None" "" \
2>&1 1>&3
) || exit 1
SCANSSID=1 SCANSSID=1
f_dialog_title_restore f_dialog_title_restore
break break
@ -237,17 +268,21 @@ while :; do
exec 3>&- exec 3>&-
done done
[ "$ENCRYPTION" ] || ENCRYPTION=$( echo "$NETWORKS" | awk -F '\t' \ [ "$ENCRYPTION" ] || ENCRYPTION=$( echo "$NETWORKS" |
"/^\"$NETWORK\"\t/ {printf(\"%s\n\", \\\$2 );}" ) awk -F '\t' "/^\"$NETWORK\"\t/ { printf(\"%s\n\", \\\$2 ); }" )
if echo $ENCRYPTION | grep -q 'PSK'; then if echo $ENCRYPTION | grep -q 'PSK'; then
exec 3>&1 exec 3>&1
PASS=$( dialog --insecure --backtitle "$DIALOG_BACKTITLE" \ PASS=$( dialog \
--title "WPA Setup" --mixedform "" 0 0 0 \ --insecure \
--backtitle "$DIALOG_BACKTITLE" \
--title "WPA Setup" \
--mixedform "" \
0 0 0 \
"SSID" 1 0 "$NETWORK" 1 12 0 0 2 \ "SSID" 1 0 "$NETWORK" 1 12 0 0 2 \
"Password" 2 0 "" 2 12 15 63 1 \ "Password" 2 0 "" 2 12 15 63 1 \
2>&1 1>&3 ) \ 2>&1 1>&3
|| exec $0 $@ ) || exec $0 $@
exec 3>&- exec 3>&-
awk 'sub(/^\t/,"")||1' \ awk 'sub(/^\t/,"")||1' \
>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
@ -260,13 +295,16 @@ if echo $ENCRYPTION | grep -q 'PSK'; then
EOF EOF
elif echo $ENCRYPTION | grep -q EAP; then elif echo $ENCRYPTION | grep -q EAP; then
exec 3>&1 exec 3>&1
USERPASS=$( dialog --insecure --backtitle "$DIALOG_BACKTITLE" \ USERPASS=$( dialog \
--title "WPA-Enterprise Setup" --mixedform "" 0 0 0 \ --insecure \
--backtitle "$DIALOG_BACKTITLE" \
--title "WPA-Enterprise Setup" \
--mixedform "" 0 0 0 \
"SSID" 1 0 "$NETWORK" 1 12 0 0 2 \ "SSID" 1 0 "$NETWORK" 1 12 0 0 2 \
"Username" 2 0 "" 2 12 25 63 0 \ "Username" 2 0 "" 2 12 25 63 0 \
"Password" 3 0 "" 3 12 25 63 1 \ "Password" 3 0 "" 3 12 25 63 1 \
2>&1 1>&3 ) \ 2>&1 1>&3
|| exec $0 $@ ) || exec $0 $@
exec 3>&- exec 3>&-
awk 'sub(/^\t/,"")||1' \ awk 'sub(/^\t/,"")||1' \
>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
@ -287,12 +325,15 @@ elif echo $ENCRYPTION | grep -q EAP; then
EOF EOF
elif echo $ENCRYPTION | grep -q WEP; then elif echo $ENCRYPTION | grep -q WEP; then
exec 3>&1 exec 3>&1
WEPKEY=$( dialog --insecure --backtitle "$DIALOG_BACKTITLE" \ WEPKEY=$( dialog \
--title "WEP Setup" --mixedform "" 0 0 0 \ --insecure \
--backtitle "$DIALOG_BACKTITLE" \
--title "WEP Setup" \
--mixedform "" 0 0 0 \
"SSID" 1 0 "$NETWORK" 1 12 0 0 2 \ "SSID" 1 0 "$NETWORK" 1 12 0 0 2 \
"WEP Key 0" 2 0 "" 2 12 15 0 1 \ "WEP Key 0" 2 0 "" 2 12 15 0 1 \
2>&1 1>&3 ) \ 2>&1 1>&3
|| exec $0 $@ ) || exec $0 $@
awk 'sub(/^\t/,"")||1' \ awk 'sub(/^\t/,"")||1' \
>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
network={ network={
@ -304,7 +345,7 @@ elif echo $ENCRYPTION | grep -q WEP; then
priority=5 priority=5
} }
EOF EOF
else # Open else # Open
awk 'sub(/^\t/,"")||1' \ awk 'sub(/^\t/,"")||1' \
>> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF >> "$BSDINSTALL_TMPETC/wpa_supplicant.conf" <<-EOF
network={ network={