Date: Tue, 13 Dec 2016 02:40:54 +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: r309989 - head/usr.sbin/bsdinstall/scripts Message-ID: <201612130240.uBD2eskc068989@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dteske Date: Tue Dec 13 02:40:54 2016 New Revision: 309989 URL: https://svnweb.freebsd.org/changeset/base/309989 Log: There's an API function for catching errors and displaying them or logging them to debug output Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/wlanconfig Tue Dec 13 02:30:24 2016 (r309988) +++ head/usr.sbin/bsdinstall/scripts/wlanconfig Tue Dec 13 02:40:54 2016 (r309989) @@ -52,8 +52,9 @@ country_set() # Regdomain/country cannot be applied while interface is running iface_up=$( ifconfig -lu | grep -w "$WLAN_IFACE" ) [ "$iface_up" ] && ifconfig "$WLAN_IFACE" down - error_str=$( ifconfig "$WLAN_IFACE" $ifconfig_args 2>&1 | - sed -e 's/ifconfig: //' ) + f_eval_catch -dk error_str wlanconfig ifconfig "ifconfig %s %s" \ + "$WLAN_IFACE" "$ifconfig_args" + error_str="${error_str#ifconfig: }" if [ "$iface_up" ]; then # Restart wpa_supplicant(8) (should not fail). wpa_supplicant -B -i "$WLAN_IFACE" -c \ @@ -165,22 +166,17 @@ EOF # Try to reach wpa_supplicant. If it isn't running and we can modify the # existing system, start it. Otherwise, fail. # -if ! wpa_cli ping > /dev/null 2>&1; then +if ! f_eval_catch -d wlanconfig wpa_cli "wpa_cli ping"; then if [ ! "$BSDINSTALL_CONFIGCURRENT" ]; then f_show_err "Wireless cannot be configured without %s" \ "making changes to the local system!" exit 1 fi - wpa_supplicant -B -i $1 -c "$BSDINSTALL_TMPETC/wpa_supplicant.conf") || exit 1 + f_eval_catch wlanconfig wpa_supplicant \ + 'wpa_supplicant -B -i "%s" -c "%s/wpa_supplicant.conf"' \ + "$1" "$BSDINSTALL_TMPETC" || exit 1 - if ! wpa_cli ping > /dev/null 2>&1 && [ ! "$BSDINSTALL_CONFIGCURRENT" ]; then - $DIALOG \ - --title "$msg_error" \ - --backtitle "$DIALOG_BACKTITLE" \ - --msgbox "Could not start wpa_supplicant!" \ - 0 0 - exit 1 - fi + f_eval_catch wlanconfig wpa_cli "wpa_cli ping" || exit 1 fi # @@ -209,13 +205,12 @@ fi while :; do SCANSSID=0 - output=$( wpa_cli scan 2>&1 ) - f_dprintf "%s" "$output" + f_eval_catch -d wlanconfig wpa_cli "wpa_cli scan" f_dialog_title "Scanning" f_dialog_pause "Waiting 5 seconds to scan for wireless networks..." 5 || exit 1 - SCAN_RESULTS=$( wpa_cli scan_results ) + f_eval_catch -dk SCAN_RESULTS wlanconfig wpa_cli "wpa_cli scan_results" NETWORKS=$( echo "$SCAN_RESULTS" | awk -F '\t' ' /..:..:..:..:..:../ && $5 { printf "\"%s\"\t%s\n", $5, $4 } ' | sort | uniq ) @@ -365,8 +360,7 @@ EOF # Bring up new network if [ "$BSDINSTALL_CONFIGCURRENT" ]; then - output=$( wpa_cli reconfigure 2>&1 ) - f_dprintf "%s" "$output" + f_eval_catch -d wlanconfig wpa_cli "wpa_cli reconfigure" fi exit $SUCCESS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612130240.uBD2eskc068989>