From owner-freebsd-sysinstall@freebsd.org Fri Dec 2 21:48:12 2016 Return-Path: Delivered-To: freebsd-sysinstall@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9DC2C63E96 for ; Fri, 2 Dec 2016 21:48:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99388BE1 for ; Fri, 2 Dec 2016 21:48:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id uB2LmB6m024583 for ; Fri, 2 Dec 2016 21:48:12 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-sysinstall@FreeBSD.org Subject: [Bug 214933] [patch] bsdinstall: add support for "hidden" Wi-Fi networks Date: Fri, 02 Dec 2016 21:48:12 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: dteske@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-sysinstall@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-sysinstall@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Sysinstall Work List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 21:48:12 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D214933 --- Comment #5 from Devin Teske --- In more than one place, please replace the following construct: case $? in 0) # many lines ;; *) exit 1 esac with the following, reducing the indentation of the primary block: [ $? -eq 0 ] || exit 1 # many lines The scripts/wlanconfig module includes "dialog.subr" which provides both f_dialog_noyes() and f_dialog_yesno() (depending on which you want to be the default choice). See "bsdconfig api dialog" for more information. Please change: dialog --backtitle "FreeBSD Installer" --title "Network Selection" --yesno "Do you want to select the network manually?" 0 0 Into the following: f_dialog_yesno "Do you want to select the network manually?" And there's no need to test $? exclusively, so instead of this: dialog ... [ $? -eq 0 ] || exit 1 You can instead simply say: f_dialog_yesno ... || exit 1 However, "exit" by default retains the status of the last command when not given a number, so in reality you can say this: f_dialog_yesno ... || exit And since the "||" is an "r-value seeking" operand, you can put the exit on= a line of its own if you like for style: f_dialog_yesno "Do you want to select the network manually?" || exit # many lines That's the desired setup. The way you have it, everytime you call dialog, t= he following code is indented further and further, whereas I would like to see: f_dialog_yesno ... || exit # ... f_dialog_input ... || exit # ... f_dialog_input ... || exit Which brings us to the API for input dialog boxen. Use f_dialog_input() ins= tead of "var=3D$( dialog ... --inputbox ... )". So instead of: NETWORK=3D`dialog --backtitle "FreeBSD Installer" --title "Network Selection" --inputbox "Enter SSID" 0 0 2>&1 1>&3` First of all, we don't use `...` but instead $(...) as the former is not nest-able. But instead of the above, we would use f_dialog_input() in the following way (see: bsdconfig api -dF 'f_dialog_input$'): f_dialog_title "Network Selection" f_dialog_input NETWORK "Enter SSID" || exit f_dialog_title_restore Which introduces how to set the title if/when necessary. Feel free to use it where most appropriate (e.g., before the f_dialog_yesno()). NOTE: It's important to utilize f_dialog_title()/f_dialog_title_restore() because some systems have backtitle and title reversed (and the API takes t= his into consideration with respect to which back-end system is in-use). The restore is not strictly necessary and is optional since scripts/wlanconfig = runs in a discrete namespace, unshared with anything else (hence your ability to= use "exit" without messing up the flow of bsdinstall). However, all those issues aside, you completely neglected thew new wlan API. See the following commands for required information: % bsdconfig api media/wlan # brief oversight of functions % bsdconfig api -da media/wlan | less -R # more verbose info You should add a line toward the top scripts/wlanconfig: f_include $BSDCFG_SHARE/media/wlan.subr See also: /usr/libexec/bsdconfig/120.networking/wlanconfig The bsdconfig wireless networking is much more advanced than, and is availa= ble to, bsdinstall's. Both have a "wlanconfig" module (e.g., see "bsdconfig wif= i" or "bsdconfig wlan" or "bsdconfig wireless" -- all aliases to wlanconfig), = but bsdconfig's is WAY more advanced than bsdinstall's. It's worth taking a look at bsdconfig's wlanconfig for inspiration, but more importantly, you can actually *use* the code there in the installer. Go ahe= ad and steal code from bsdconfig to make bsdinstall better. I welcome that immensely ;D --=20 You are receiving this mail because: You are the assignee for the bug.=