History log of /freebsd-current/usr.sbin/bsdinstall/scripts/wlanconfig
Revision Date Author Comments
# 55d29905 20-May-2024 Renato Botelho <garga@FreeBSD.org>

bsdinstall: Fix wifi network selection size

Use correct variable while creating dialog used to select among
available wireless networks

Approved by: asiciliano
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D45271


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# cc42ef53 24-May-2022 Brad Davis <brd@FreeBSD.org>

bsdinstall: allow whitelabeling the scripts

Approved by: allanjude, asiciliano
Differential Revision: https://reviews.freebsd.org/D35197
Sponsored by: Rubicon Communications, LLC ("Netgate")


# 912df915 01-Mar-2022 Alfonso S. Siciliano <asiciliano@FreeBSD.org>

wlanconfig: allow to enter WiFi details if no networks found

Improve the installer: wlanconfig allows user to enter WiFi details
if no networks found, useful to connect to a hidden SSID.

PR: 246192
Reported by: emaste
Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34149


# 63939df8 20-May-2020 Devin Teske <dteske@FreeBSD.org>

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


# 850b25ab 22-Nov-2017 Ed Maste <emaste@FreeBSD.org>

Fix indentation in bsdinstall-created wpa_supplicant.conf

r309934 cleaned up some cases in bsdinstall to use heredocs but broke
the indentation of the generated output, because <<- heredocs strip
leading tabs.

PR: 221982
Reviewed by: allanjude, dteske
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13190


# a7cc5680 13-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Revert r309918 -- modern POSIX has deprecated -<#>/+<#> syntax

Special thanks to: jilles


# f3a8471e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

It's completely pointless to replace newlines with space
(this is done automatically for you upon shell expansion)


# be094a32 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

The flags of a WLAN need to be quoted (they contain things like brackets)


# 19dbb0ba 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Simplify single-line if statements


# afcce2f5 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Simplify loop by moving predicate to clause


# b46ca7ce 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Wordsmithing


# a9d33421 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Why test $? when you can test the command


# 6ef8ca67 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Restore previous comment


# 94f5aec6 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Both simplify bringup of interface after changes and catch errors in debug


# b9f60aba 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Calculate proper size of menu list dialog


# 9a46c67a 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

There's an API function for catching errors and displaying them or
logging them to debug output


# 7e1166de 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

There's an API function for displaying pauses


# d79a1355 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

There's an API function for displaying yes/no dialogs


# 1d92999c 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

There's an API function for displaying errors


# 35af83c1 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Comment


# b45548a8 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Whitespace alignment


# d5fddc4d 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Relying on dialog auto-sizing (width/height/rows = 0) is a mistake
Use the provided API for calculating the appropriate size of menus


# 7599c854 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove unnecessary quotes


# 1095816e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Add missing quotes


# 01a2404c 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

In awk, if you're going to append a newline to your printf
AND you're going to print only the argument, just use print


# dba958af 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

This statement has too many backslashes


# be34885e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Neither printf (and as is commonly known) nor print need parens in awk


# 5943bcd1 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Whitespace and alignment


# 191441ee 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

You don't need parentheses for awk's printf


# 0724c87c 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Continued resolution of conveluted statement
We shouldn't be coding things like "x || (x && x) || x || x || x ..."


# 32c34b03 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

These two error messages have always been backwards since inception


# 7f513d36 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Why use $? when you can use the command itself


# 6b77f63e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

If the first ping succeeded, why on Earth should we ping it again?


# a1a6fec1 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Start deconstructing a conveluted hunk of code


# 19cae84e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove completely unnecesary parentheses


# 75199394 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Why repeat yourself when you can send stderr to the same place as stdout?


# 66ef7d94 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Properly quote variable


# a5119576 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use more generic f_yesno() from provided API


# f52733d4 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

The output of dialog needs to be sanitized
for portability/compatibility requirements


# f20b7768 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Whitespace alignment


# d401d36c 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Sort the domains


# 95ee591e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

The --no-items and --stdout options are non-standard and should be avoided

From the dialog(1) manual:
using [--stdout] in portable scripts is not recommended


# 6e038cc2 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

More efficiently make use of the exit status


# 1c612112 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Stop repeating strings (centralize prompt string)
NB: Changes to strings now only affect a single line


# e2577019 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Add missing backslash (no real effect; it's pedantic and correct for
the interpolation level)


# e7f2eb12 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use the oft-neglected awk syntax "startcondition, stopcondition { ... }" to
process the range of country labels which appear as columnar list from the
"ifconfig DEV list countries" command. Not only improving maintainability,
but also properly encapsulating arguments in single-quotes instead of
trying to escape whitespace. It is also completely unnecessary to collapse
newlines into whitespace (shell will do this for you automatically upon
expansion of the contents where necessary).

NB: This also changes the sorting algorithm to sort on the country code,
not the country name. The type-ahead feature of dialog is destroyed if the
tags are not sorted properly.


# 49748e0a 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Quote WLAN_IFACE (pedantic)


# 6c26775c 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

In awk, casting a variable as a boolean condition is the same as testing if
the length of the variable contents is greater than zero

This allows us to also move the secondary condition into the action clause


# 275c0c07 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove an unnecessary call to f_dialog_title_restore()


# 10458583 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Whitespace


# d124dfc4 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Utilize provided i18n strings


# 877ea047 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove incomplete and unnecessary creation of fd3

The provided API already provides a passthru descriptor and even
gives you a varaible for referring to it.


# 8bcf5646 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove unnecessary semi-colons


# 0b8f01fe 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use awk the following (more succinct) awk syntax:

condition1 { action1 }
condition2 { action2 }

instead of the following syntax:

{
if (condition1) { action1 }
else if (condition2) { action2 }
}


# d9f83eb9 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

1 is the default descriptor for redirects without an fd prefix


# bef42d18 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Fix invalid parameter expansion (change $@ to "$@")

Without quotes, $@ loses its special meanining (see below)

% sh -c 'echo $@' /bin/sh " 1 " " 2 "
1 2
% sh -c 'echo "$@"' /bin/sh " 1 " " 2 "
1 2

The quotes are required to get ARGV to be unperterped


# 35c8d5eb 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Allow the script path to contain whitespace and special characters


# 58ce2edc 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use provided API to centralize dialog title strings


# 7797a597 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Reorder dialog parameters based on commonality for readability


# 6ea6e3fa 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Fix incorrect use of provided API
The result of which was incorrectly sized menu dialogs


# ea2e60b0 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use provided API (change "dialog" to "$DIALOG")


# 2abc4c24 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Whitespace (dialog options separated to minimize diffs)


# b5938e7d 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Consolidate redirects into here documents, with proper code indentation


# 15fadc48 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove an unnecessary "return $?" at end of function


# 7bcf4508 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use ternary operator


# 0e638f57 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

If you're not going to make use of the products of a match() in awk
(e.g., RSTART and RLENGTH variables) then use ~ instead of match()


# 71ef4d58 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Now that these variables do not contain the --default-item flag itself,
change the name of the variable from $def_item_... to $default_...


# 86e1d297 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Always pass --default-item parameter to dialog


# 48e9fce2 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

There is zero harm in always passing --default-item to dialog


# 58dc38bd 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Centralize backtitle string


# 5357f8f7 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use provided API instead of hard-coded status integers


# 76b07bd9 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Whitespace


# 9ca8b7be 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove unnecessary `-n' parameter to head/tail


# 32043642 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

awk(1) match() takes a regex, use /.../ to remind ourselves of this
NB: The difference between "..." and /.../ for a regex in awk is that
quoted strings go through escape expansion first (e.g., \\ becomes \)


# 4fa8c81c 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Be internally consistent (": > ..." is used elsewhere in this file)


# edcf3303 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

"echo | sed | sed | awk" is silly (changed to "echo | awk")


# 1cac9fc2 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Add missing `-e' parameter to sed invocations


# 8d5182d6 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Allow $BSDINSTALL_TMPETC to contain whitespace or special chars


# c62801e2 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Group fallbacks together


# 0b04945d 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove unnecessary quotes around number in test


# e9c843ad 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Change "[ ! ... ] && ..." to "[ ... ] || ..."


# e2025334 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Collapse tiny if statements


# 114a587e 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Replace funny block with something easy to digest


# bede0708 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Consolidate locals


# 5b57fabb 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove unnecessary local initializers


# 38a99423 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Change "[ ! -z ... ]" => "[ ... ]" and "[ -z ... ]" => "[ ! ... ]"


# 138ab67a 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Use $( ... ) instead of `...`


# 97a4c9f0 12-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Comments


# f18789d7 08-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Functions in their own section


# 3d2b0857 08-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Remove unnecessary trailing backslashes


# 3220bdd8 08-Dec-2016 Devin Teske <dteske@FreeBSD.org>

Add support for "hidden" Wi-Fi networks

PR: bin/214933
Submitted by: Maxim Filimonov <che@bein.link>
Reviewed by: dteske, allanjude, adrian
MFC after: 6 days
X-MFC-with: Follow-up commit for style


# 4913f849 08-Jun-2016 Andriy Voskoboinyk <avos@FreeBSD.org>

bsdinstall: add country/regulatory domain configuration dialog.

Allow to setup country and/or regulatory domain before scanning
(since channel list is affected by regulatory restrictions this may
impact scan results).

PR: 182600 (originally)
Differential Revision: https://reviews.freebsd.org/D6325


# 0a835493 11-Sep-2015 Devin Teske <dteske@FreeBSD.org>

Use a variable for readability

MFC after: 3 days
X-MFC-to: stable/10


# 093b9154 04-Jan-2014 Gavin Atkinson <gavin@FreeBSD.org>

Allow bsdinstall to use WPA-Enterprise networks when installing. This
only allows basic username/password config, and does not provide the
ability to set any of the other WPA options. Regardless, this is
generally sufficient to associate.

Perhaps in the future this could allow full configuring (e.g. being able
to set "anonymous identity", and perhaps some of the more obscure WPA
options), though perhaps that will better belong in bsdconfig when that
grows wlan config ability.

MFC after: 1 week


# ebffa060 04-Jan-2014 Gavin Atkinson <gavin@FreeBSD.org>

Lower the priority of the "connect to any open wireless network" network
description, so guaranteeing that any other defined network will be tried
first.

MFC after: 1 week


# f051e63a 04-Jan-2014 Gavin Atkinson <gavin@FreeBSD.org>

Remove what appears to be a stray debugging printf.

MFC after: 1 week


# bc4a673f 08-Nov-2013 Devin Teske <dteske@FreeBSD.org>

A series of changes tested together as a whole:
+ Add a `-D FILE" command-line option for overriding the path to the
bsdinstall log file (BSDINSTALL_LOG env var).
+ Document new `-D FILE' in the man page for bsdinstall.
+ If FILE in `-D FILE' begins with a +, debug output goes to stdout
(interleaved between dialog(1) invocations/output) as well as to FILE
(minus the leading + of course).
+ If BSDINSTALL_LOG cannot be written, then debugging is disabled (except in
the case of a leading + in the pathname, wherein debug will still be
printed to stdout).
+ Update source code formatting style.
+ Fix a dangling participle ("Begun ..." -> "Began ...")
+ Rewrite the docsinstall script (was necessary to abate direct dependency
on BSDINSTALL_LOG (instead, use fault-tolerant bsdconfig framework which
displays appropriate errors for package management).
NB: docsinstall is still using pkg(8) after this change.
+ Add additional debug output for dhclient/rtsol/wpa_cliscan
+ Display script errors in a textbox rather than just on stdout
+ Update many coments.
+ Add new f_show_err() API call (like f_show_msg but changes the dialog
title to "Error")(see bsdconfig's `common.subr').
+ Add new f_eval_catch() API call for executing a command via eval but not
before logging the command to debug. Several example cases documented in
API header for function in bsdconfig's `common.subr'.
+ Fix dialog auto-sizing when launched as an rvalue to a pipe for indirected
scripts (previously would default to 24x80 sizing in this case, now it can
autosize to full size even when in a pipe chain).
+ Fix bug in f_snprintf if $format argument began with "-"; printf would
misinterpret as a flag. (this is in bsdcofig's `strings.subr').
+ Add accompanying f_sprintf() and f_vsprintf() to go along with already
existing f_snprintf() and f_vsnprintf() (see bsdconfig's `strings.subr').
+ Remove some unnecessary default ZFS datasets from the automatic "zfsboot"
script. Such as: /usr/ports/distfiles /usr/ports/packages /usr/obj /var/db
/var/empty /var/mail and /var/run (these can all be created as-needed once
the system is installed).
+ Remove setuid=off for /usr/home (as discussed from last round of CFT).
+ Fix some i18n string violations in "zfsboot".
+ Bolster debugging output in "zfsboot".
+ Fix some string quoting issues in "zfsboot".
+ Fix some variable scope issues in "zfsboot".
+ Change "Create" to "Install" in "zfsboot" main menu.
+ Increase error checking in "zfsboot" (type-check arguments and such).
+ Add call to "graid destroy" killing automatic metadata (part of the series
of pedantic destructions we do when bootstrapping a new/naked disk).
+ Make judicious use of new f_eval_catch() in "zfsboot".
+ Fixup some variable names for consistency (zfsboot).
+ Fix an underride syntax parameter expansion folly (zfsboot).
+ Confirm layout if not explicitly chosen when blindly proceeding (no
longer have to touch anything on the ZFS menu if it scares you, just
choose the omnibus "Install" option at the top and you'll be prompted to
select vdev type and disks in the layout confirmation dialog).
+ Change numbered menu items to alphabetic for more efficient navigation.
+ Consolidate vdev selection and disk selection into a single stateful
menu which performs validation and allows backing out to each previous
menu as you go deeper.
+ Redesign the ``Last Chance'' dialog (still using the same colors, but
make it conform to a tolerable width and make disks appear in a block-
quote style indented region).
+ Fix a bug wherein we used the a lowercase variable name by accident
(actual variable name declared as all-uppercase) at the time of
initializing fstab(5) (not believed to cause any issues though).
+ Update the geli setup infobox for each provider being initialized
(not just at the onset -- since each ``geli init'' causes kernel messages
to push our infobox off-screen).

Reviewed by: Allan Jude <freebsd@allanjude.com>
Discussed on: -current
MFC after: 3 days


# c3955762 27-Jan-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Properly quote argument.

MFC after: 3 days


# a4de89de 13-Sep-2011 Christian Brueffer <brueffer@FreeBSD.org>

Allow WPA PSKs up to 63 characters, the max length according to
wpa_supplicant.conf(5). Up to now, the PSK was truncated
to 15 characters (the length of the input field).

PR: 159559
Submitted by: Gavin Chappell <gavin.chappell@gmail.com>
Approved by: re (kib)


# 11e3829e 04-Apr-2011 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Check correctly for whether there are any available wireless networks. This
was tested on a train in the middle of an upstate New York swamp.


# 2118f387 18-Feb-2011 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Import bsdinstall. This is meant to be (eventually in conjunction with
pc-sysinstall) a replacement for sysinstall in the 9.0 release and beyond.
Currently supported platforms are sparc64, pc98, i386, amd64, powerpc, and
powerpc64. Integration into the build system will occur in the coming
weeks.

Merging with pc-sysinstall will use this code as a frontend, while
temporarily retaining the interactive partition editor here. This work
will be done in parallel with improvements on this code and release
integration.

Thanks to all who have provided testing and comments!