Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Nov 2013 03:40:52 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r258421 - in stable/10/usr.sbin/bsdinstall: . scripts
Message-ID:  <201311210340.rAL3eqKt005257@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Thu Nov 21 03:40:52 2013
New Revision: 258421
URL: http://svnweb.freebsd.org/changeset/base/258421

Log:
  MFC Revisions:
  256549: man-page updates
  256551: .Dd bump in manpage
  256553: bootenv -> ROOT fix
  257842: monster list of fixes
  257843: minor touchup
  257844: copy install log
  257845: fixup to last
  257872: mdoc fixup
  257939: debug check
  258021: MBR bootcode fixup
  
  Reviewed by:	many
  Discussed on:	-current
  Approved by:	re (hrs)

Modified:
  stable/10/usr.sbin/bsdinstall/bsdinstall
  stable/10/usr.sbin/bsdinstall/bsdinstall.8
  stable/10/usr.sbin/bsdinstall/scripts/auto
  stable/10/usr.sbin/bsdinstall/scripts/config
  stable/10/usr.sbin/bsdinstall/scripts/docsinstall
  stable/10/usr.sbin/bsdinstall/scripts/jail
  stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4
  stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6
  stable/10/usr.sbin/bsdinstall/scripts/script
  stable/10/usr.sbin/bsdinstall/scripts/wlanconfig
  stable/10/usr.sbin/bsdinstall/scripts/zfsboot
Directory Properties:
  stable/10/usr.sbin/bsdinstall/   (props changed)

Modified: stable/10/usr.sbin/bsdinstall/bsdinstall
==============================================================================
--- stable/10/usr.sbin/bsdinstall/bsdinstall	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/bsdinstall	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,17 +26,62 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+# Delay processing of debug flags as the parent until MAIN. export'd to disable
+# re-processing of flags (all children log to the parent's log file).
+#
+export DEBUG_SELF_INITIALIZE=
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+
+############################################################ GLOBALS
 
-: ${BSDINSTALL_LOG="/tmp/bsdinstall_log"}; export BSDINSTALL_LOG
 : ${BSDINSTALL_TMPETC="/tmp/bsdinstall_etc"}; export BSDINSTALL_TMPETC
 : ${BSDINSTALL_TMPBOOT="/tmp/bsdinstall_boot"}; export BSDINSTALL_TMPBOOT
 : ${PATH_FSTAB="$BSDINSTALL_TMPETC/fstab"}; export PATH_FSTAB
 : ${BSDINSTALL_DISTDIR="/usr/freebsd-dist"}; export BSDINSTALL_DISTDIR
 : ${BSDINSTALL_CHROOT="/mnt"}; export BSDINSTALL_CHROOT
 
-VERB=${1:-auto}; shift
+export debugFile="${debugFile-${BSDINSTALL_LOG-/tmp/bsdinstall_log}}"
+
+############################################################ MAIN
+
+#
+# Process command-line arguments
+#
+while getopts $GETOPTS_STDARGS ignored; do
+	: just skipping known flags
+done
+shift $(( $OPTIND - 1 ))
+
+# What are we here to do?
+VERB="${1:-auto}"; shift
 
 [ -d "$BSDINSTALL_TMPETC" ] || mkdir -p "$BSDINSTALL_TMPETC"
 [ -d "$BSDINSTALL_TMPBOOT" ] || mkdir -p "$BSDINSTALL_TMPBOOT"
-echo "Running installation step: $VERB $@" >> "$BSDINSTALL_LOG"
-exec "/usr/libexec/bsdinstall/$VERB" "$@" 2>> "$BSDINSTALL_LOG"
+
+# Only enable debugging if debugFile is non-NULL and can be initialized
+f_quietly f_debug_init
+f_isset debugFile || debug=
+
+f_dprintf "Running installation step: %s %s" "$VERB" "$*"
+if [ "$debug" ]; then
+	case "$debugFile" in
+	# If NULL, send errors to the bit-bucket
+	"") exec "/usr/libexec/bsdinstall/$VERB" "$@" 2> /dev/null ;;
+	# If begins with `+', send errors to both terminal and file (no `+')
+	+*) exec "/usr/libexec/bsdinstall/$VERB" "$@" \
+		2>&1 >&$TERMINAL_STDOUT_PASSTHRU | tee "${debugFile#+}" ;;
+	# Otherwise, just send errors to the file specified
+	*) exec "/usr/libexec/bsdinstall/$VERB" "$@" 2>> "$debugFile"
+	esac
+else
+	exec "/usr/libexec/bsdinstall/$VERB" "$@" 2> /dev/null
+fi
+
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/bsdinstall.8
==============================================================================
--- stable/10/usr.sbin/bsdinstall/bsdinstall.8	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/bsdinstall.8	Thu Nov 21 03:40:52 2013	(r258421)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 6, 2013
+.Dd October 15, 2013
 .Dt BSDINSTALL 8
 .Os
 .Sh NAME
@@ -33,6 +33,7 @@
 .Nd system installer
 .Sh SYNOPSIS
 .Nm
+.Op Ar options
 .Op Ar target
 .Op Ar ...
 .Sh DESCRIPTION
@@ -49,6 +50,18 @@ invoked with no arguments, it will invok
 target, which provides a standard interactive installation, invoking the
 others in sequence. To perform a scripted installation, these subtargets
 can be invoked separately by an installation script.
+.Sh OPTIONS
+.Nm
+supports the following options, global to all targets:
+.Bl -tag -width indent+
+.It Fl D Ar file
+Provide a path for the installation log file
+.Pq overrides Ev BSDINSTALL_LOG .
+See
+.Sx ENVIRONMENT VARIABLES
+for more information on
+.Ev BSDINSTALL_LOG .
+.El
 .Sh TARGETS
 Most of the following targets are only useful for scripting the installer.
 For interactive use, most users will be interested only in the
@@ -108,6 +121,21 @@ installations. Partitions disks, runs
 .Xr newfs 8 ,
 and writes the new system's
 .Pa fstab .
+.It Cm zfsboot
+Provides the installer's
+.Pq experimental
+interactive/scriptable ZFS partitioner for multi-disk installations.
+Creates a single
+.Ic zpool
+with datasets and writes to the new system's
+.Pa rc.conf ,
+.Pa loader.conf ,
+and
+.Pa fstab .
+Supports
+.Xr geli 8 ,
+.Xr gnop 8 ,
+and many other features.
 .It Cm partedit
 Provides the installer's interactive manual disk partitioner, with support
 for multi disk setups, non-UFS file systems, and manual selection of
@@ -315,6 +343,15 @@ the preamble can contain a variable
 which is passed to the
 .Cm scriptedpart
 target to control disk setup.
+Alternatively,
+instead of
+.Ev PARTITIONS ,
+the preamble can contain the variable
+.Ev ZFSBOOT_DATASETS
+which is parsed by the
+.Pq experimental
+.Cm zfsboot
+target to control ZFS datasets/options of the boot pool setup.
 .Ss SETUP SCRIPT
 Following the preamble is an optional shell script, beginning with a #!
 declaration. This script will be run at the end of the installation process

Modified: stable/10/usr.sbin/bsdinstall/scripts/auto
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/auto	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/auto	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,8 +26,13 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
 
-echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
+############################################################ FUNCTIONS
 
 error() {
 	test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR
@@ -41,6 +47,9 @@ error() {
 	fi
 }
 
+############################################################ MAIN
+
+f_dprintf "Began Installation at %s" "$( date )"
 
 rm -rf $BSDINSTALL_TMPETC
 mkdir $BSDINSTALL_TMPETC
@@ -126,7 +135,12 @@ case "$PARTMODE" in
 	sh 2>&1
 	;;
 "Manual")	# Manual
-	bsdinstall partedit || error
+	if f_isset debugFile; then
+		# Give partedit the path to our logfile so it can append
+		BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error
+	else
+		bsdinstall partedit || error
+	fi
 	bsdinstall mount || error
 	;;
 "ZFS")	# ZFS
@@ -247,5 +261,8 @@ fi
 bsdinstall entropy
 bsdinstall umount
 
-echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG
+f_dprintf "Installation Completed at %s" "$( date )"
 
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/config
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/config	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/config	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,6 +26,8 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ MAIN
 
 cat $BSDINSTALL_TMPETC/rc.conf.* >> $BSDINSTALL_TMPETC/rc.conf
 rm $BSDINSTALL_TMPETC/rc.conf.*
@@ -36,6 +39,11 @@ rm $BSDINSTALL_TMPBOOT/loader.conf.*
 
 cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot
 
+[ "${debugFile#+}" ] && cp "${debugFile#+}" $BSDINSTALL_CHROOT/var/log/
+
 # Set up other things from installed config
 chroot $BSDINSTALL_CHROOT /usr/bin/newaliases
 
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/docsinstall
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/docsinstall	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/docsinstall	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Marc Fonvieille
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,62 +26,137 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
+f_include $BSDCFG_SHARE/mustberoot.subr
+f_include $BSDCFG_SHARE/packages/packages.subr
 
+############################################################ CONFIGURATION
 
-exec 3>&1
-DOCS=$(dialog --backtitle "FreeBSD Installer" \
-    --title "FreeBSD Documentation Installation" --separate-output \
-    --checklist "This menu will allow you to install the whole documentation set
-from the FreeBSD Documentation Project: Handbook, FAQ and articles.\n\n
-Please select the language versions you wish to install.  At minimum,
-you should install the English version, this is the original version
-of the documentation.\n\n
-NB: This requires a working, configured network connection." 0 0 0 \
-	bn	"Bengali Documentation" ${DIST_DOC_BN:-off} \
-	da	"Danish Documentation" ${DIST_DOC_DA:-off} \
-	de	"German Documentation" ${DIST_DOC_DE:-off} \
-	el	"Greek Documentation" ${DIST_DOC_EL:-off} \
-	en	"English Documentation (recommended)" ${DIST_DOC_EN:-on} \
-	es	"Spanish Documentation" ${DIST_DOC_ES:-off} \
-	fr	"French Documentation" ${DIST_DOC_FR:-off} \
-	hu	"Hungarian Documentation" ${DIST_DOC_HU:-off} \
-	it	"Italian Documentation" ${DIST_DOC_IT:-off} \
-	ja	"Japanese Documentation" ${DIST_DOC_JA:-off} \
-	mn	"Mongolian Documentation" ${DIST_DOC_MN:-off} \
-	nl	"Dutch Documentation" ${DIST_DOC_NL:-off} \
-	pl	"Polish Documentation" ${DIST_DOC_PL:-off} \
-	pt	"Portuguese Documentation" ${DIST_DOC_PT:-off} \
-	ru	"Russian Documentation" ${DIST_DOC_RU:-off} \
-	sr	"Serbian Documentation" ${DIST_DOC_SR:-off} \
-	tr	"Turkish Documentation" ${DIST_DOC_TR:-off} \
-	zh_cn	"Simplified Chinese Documentation" ${DIST_DOC_ZH_CN:-off} \
-	zh_tw	"Traditional Chinese Documentation" ${DIST_DOC_ZH_TW:-off} \
-2>&1 1>&3)
-test $? -eq 0 || exit 0
-exec 3>&-
-
-# Let pkg(8) be able to use name servers
-cp ${BSDINSTALL_TMPETC}/resolv.conf ${BSDINSTALL_CHROOT}/etc
-
-error() {
-	dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox \
-	    "Could not install package $1 (`tail -n 1 ${BSDINSTALL_LOG}`)" 0 0
-	exit 1
+#
+# List of languages to display (descriptions pulled from $msg_{lang}doc_desc)
+#
+: ${DOCSINSTALL_LANGS:=\
+	bn da de el en es fr hu it ja mn nl pl pt ru sr tr zh_cn zh_tw \
 }
 
+############################################################ GLOBALS
+
+#
+# Strings that should be moved to an i18n file and loaded with f_include_lang()
+#
+hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER"
+msg_bndoc_desc="Bengali Documentation"
+msg_cancel="Cancel"
+msg_dadoc_desc="Danish Documentation"
+msg_dedoc_desc="German Documentation"
+msg_docsinstall_menu_text="This menu allows you to install the whole documentation set from\nthe FreeBSD Documentation Project: Handbook, FAQ, and articles.\n\nPlease select the language versions you wish to install. At\nminimum, you should install the English version, the original\nversion of the documentation."
+msg_eldoc_desc="Greek Documentation"
+msg_endoc_desc="English Documentation (recommended)"
+msg_esdoc_desc="Spanish Documentation"
+msg_frdoc_desc="French Documentation"
+msg_freebsd_documentation_installation="FreeBSD Documentation Installation"
+msg_freebsd_installer="FreeBSD Installer"
+msg_hudoc_desc="Hungarian Documentation"
+msg_itdoc_desc="Italian Documentation"
+msg_jadoc_desc="Japanese Documentation"
+msg_mndoc_desc="Mongolian Documentation"
+msg_nldoc_desc="Dutch Documentation"
+msg_ok="OK"
+msg_pldoc_desc="Polish Documentation"
+msg_ptdoc_desc="Portuguese Documentation"
+msg_rudoc_desc="Russian Documentation"
+msg_srdoc_desc="Serbian Documentation"
+msg_trdoc_desc="Turkish Documentation"
+msg_zh_cndoc_desc="Simplified Chinese Documentation"
+msg_zh_twdoc_desc="Traditional Chinese Documentation"
+
+############################################################ FUNCTIONS
+
+# dialog_menu_main
+#
+# Display the dialog(1)-based application main menu.
+#
+dialog_menu_main()
+{
+	local title="$DIALOG_TITLE"
+	local btitle="$DIALOG_BACKTITLE"
+	local prompt="$msg_docsinstall_menu_text"
+	local check_list= # Calculated below
+	local hline="$hline_arrows_space_tab_enter"
+
+	local lang desc upper status
+	for lang in $DOCSINSTALL_LANGS; do
+		# Fetch the i18n description to display
+		f_getvar msg_${lang}doc_desc desc
+		f_shell_escape "$desc" desc
+
+		# Get default status for each language
+		upper=$( echo "$lang" | awk '{print toupper($0)}' )
+		case "$lang" in
+		en) f_getvar DIST_DOC_$upper:-on status ;;
+		 *) f_getvar DIST_DOC_$upper:-off status
+		esac
+
+		check_list="$check_list
+			'$lang' '$desc' '$status'
+		" # END-QUOTE
+	done
+
+	local height width rows
+	eval f_dialog_checklist_size height width rows \
+	                             \"\$title\"  \
+	                             \"\$btitle\" \
+	                             \"\$prompt\" \
+	                             \"\$hline\"  \
+	                             $check_list
+	local selected
+	selected=$( eval $DIALOG \
+		--title \"\$title\"             \
+		--backtitle \"\$btitle\"        \
+		--hline \"\$hline\"             \
+		--ok-label \"\$msg_ok\"         \
+		--cancel-label \"\$msg_cancel\" \
+		--checklist \"\$prompt\"        \
+		$height $width $rows            \
+		$check_list                     \
+		2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
+	)
+	local retval=$?
+	f_dialog_menutag_store -s "$selected"
+	return $retval
+}
 
-clear
-echo "FreeBSD Installer"
-echo "========================"
-echo
-
-echo "Please wait while the repository metadata is fetched."
-echo "This may take a few moments."
-
-env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install pkg \
-	|| error pkg
-
-for i in $DOCS; do
-    env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install ${i}-freebsd-doc \
-	|| error $i-freebsd-doc
+############################################################ MAIN
+
+#
+# Initialize
+#
+f_dialog_title "$msg_freebsd_documentation_installation"
+f_dialog_backtitle "$msg_freebsd_installer"
+f_mustberoot_init
+
+#
+# Launch application main menu
+#
+dialog_menu_main || f_die
+f_dialog_menutag_fetch selected
+
+# Let pkg_add be able to use name servers
+f_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/
+
+#
+# Install each of the selected packages
+#
+for lang in $selected; do
+	f_package_add $lang-freebsd-doc || return $FAILURE
 done
+
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/jail
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/jail	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/jail	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,8 +26,15 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+
+############################################################ MAIN
 
-echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
+f_dprintf "Began Installation at %s" "$( date )"
 export BSDINSTALL_CHROOT=$1
 
 error() {
@@ -112,5 +120,8 @@ cp /etc/localtime $1/etc
 
 bsdinstall entropy
 
-echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG
+f_dprintf "Installation Completed at %s" "$(date)"
 
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,13 +26,15 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
 
-: ${DIALOG_OK=0}
-: ${DIALOG_CANCEL=1}
-: ${DIALOG_HELP=2}
-: ${DIALOG_EXTRA=3}
-: ${DIALOG_ITEM_HELP=4}
-: ${DIALOG_ESC=255}
+############################################################ MAIN
 
 INTERFACE=$1
 IFCONFIG_PREFIX="$2"
@@ -49,8 +52,9 @@ if [ $? -eq $DIALOG_OK ]; then
 
 	if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
 		dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0
-		dhclient $INTERFACE 2>> $BSDINSTALL_LOG
+		err=$( dhclient $INTERFACE 2>&1 )
 		if [ $? -ne 0 ]; then
+			f_dprintf "%s" "$err"
 			dialog --backtitle 'FreeBSD Installer' --msgbox "DHCP lease acquisition failed." 0 0
 			exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}"
 		fi
@@ -86,3 +90,6 @@ if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; t
 	fi
 fi
 
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv6	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,8 +1,8 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
-# All rights reserved.
 # Copyright (c) 2011 The FreeBSD Foundation
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Portions of this software were developed by Bjoern Zeeb
@@ -30,19 +30,21 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
+
+############################################################ MAIN
 
 #
 # TODO: 
 # - Add DHCPv6 support once FreeBSD ships with it.
 # 
 
-: ${DIALOG_OK=0}
-: ${DIALOG_CANCEL=1}
-: ${DIALOG_HELP=2}
-: ${DIALOG_EXTRA=3}
-: ${DIALOG_ITEM_HELP=4}
-: ${DIALOG_ESC=255}
-
 INTERFACE=$1
 case "${INTERFACE}" in
 "")	dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' \
@@ -61,8 +63,9 @@ while : ; do
 			dialog --backtitle 'FreeBSD Installer' \
 			    --infobox "Sending Router Solicitation ..." 0 0
 			ifconfig ${INTERFACE} inet6 -ifdisabled accept_rtadv up
-			rtsol -F $INTERFACE 2>> $BSDINSTALL_LOG
+			err=$( rtsol -F $INTERFACE 2>&1 )
 			if [ $? -ne 0 ]; then
+				f_dprintf "%s" "$err"
 				dialog --backtitle 'FreeBSD Installer' --msgbox "SLAAC failed." 0 0
 				AGAIN=" again"
 				continue
@@ -148,3 +151,6 @@ if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; t
 	fi
 fi
 
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/script
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/script	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/script	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2013 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,27 +26,55 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+f_dprintf "%s: loading includes..." "$0"
+f_include $BSDCFG_SHARE/dialog.subr
+f_include $BSDCFG_SHARE/variable.subr
+
+############################################################ CONFIGURATION
 
 # VARIABLES:
 # PARTITIONS
 # DISTRIBUTIONS
 # BSDINSTALL_DISTDIR
 
-error() {
-	test -f $PATH_FSTAB && bsdinstall umount
-	echo "Installation Error!"
-	cat $BSDINSTALL_LOG
-	echo "Installation Error!"
+############################################################ GLOBALS
+
+#
+# Strings that should be moved to an i18n file and loaded with f_include_lang()
+#
+msg_installation_error="Installation Error!"
+
+############################################################ FUNCTIONS
+
+error()
+{
+	[ -f "$PATH_FSTAB" ] && bsdinstall umount
+	
+	local file
+	f_getvar "$VAR_DEBUG_FILE#+" file
+	if [ "$file" ]; then
+		f_dialog_title "$msg_installation_error"
+		f_dialog_textbox "$file"
+		# No need to restore title, pining for the fjords
+	fi
+
 	exit 1
 }
 
+############################################################ MAIN
+
 set -e
 trap error EXIT
 
 SCRIPT="$1"
 shift
 
-echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
+f_dprintf "Began Instalation at %s" "$( date )"
 rm -rf $BSDINSTALL_TMPETC
 mkdir $BSDINSTALL_TMPETC
 
@@ -55,6 +84,14 @@ split -a 2 -p '^#!.*' "$SCRIPT" /tmp/bsd
 : ${DISTRIBUTIONS="kernel.txz base.txz"}; export DISTRIBUTIONS
 export BSDINSTALL_DISTDIR
 
+# Re-initialize a new log if preamble changed BSDINSTALL_LOG
+if [ "$BSDINSTALL_LOG" != "${debugFile#+}" ]; then
+	export debugFile="$BSDINSTALL_LOG"
+	f_quietly f_debug_init
+	# NB: Being scripted, let debug go to terminal for invalid debugFile
+	f_dprintf "Began Instalation at %s" "$( date )"
+fi
+
 # Make partitions
 rm -f $PATH_FSTAB
 touch $PATH_FSTAB
@@ -86,6 +123,10 @@ fi
 bsdinstall entropy
 bsdinstall umount
 
-echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG
+f_dprintf "Installation Completed at %s" "$( date )"
 
 trap true EXIT
+
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/wlanconfig
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/wlanconfig	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/wlanconfig	Thu Nov 21 03:40:52 2013	(r258421)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-
 # Copyright (c) 2011 Nathan Whitehorn
+# Copyright (c) 2013 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -25,6 +26,13 @@
 # SUCH DAMAGE.
 #
 # $FreeBSD$
+#
+############################################################ INCLUDES
+
+BSDCFG_SHARE="/usr/share/bsdconfig"
+. $BSDCFG_SHARE/common.subr || exit 1
+
+############################################################ MAIN
 
 echo -n > $BSDINSTALL_TMPETC/wpa_supplicant.conf
 chmod 0600 $BSDINSTALL_TMPETC/wpa_supplicant.conf
@@ -50,7 +58,8 @@ if [ $? -ne 0 -a -z $BSDINSTALL_CONFIGCU
 	exit 1
 fi
 
-wpa_cli scan >>$BSDINSTALL_LOG
+output=$( wpa_cli scan 2>&1 )
+f_dprintf "%s" "$output"
 dialog --backtitle "FreeBSD Installer" --title "Scanning" --ok-label "Skip" \
 	--pause "Waiting 5 seconds to scan for wireless networks..." \
 	9 40 5 || exit 1
@@ -132,6 +141,13 @@ echo "network={
 }" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf
 
 # Bring up new network
-test ! -z $BSDINSTALL_CONFIGCURRENT && wpa_cli reconfigure >>$BSDINSTALL_LOG
+if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
+	output=$( wpa_cli reconfigure 2>&1 )
+	f_dprintf "%s" "$output"
+fi
 
 exit 0
+
+################################################################################
+# END
+################################################################################

Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/zfsboot	Thu Nov 21 03:38:47 2013	(r258420)
+++ stable/10/usr.sbin/bsdinstall/scripts/zfsboot	Thu Nov 21 03:40:52 2013	(r258421)
@@ -47,7 +47,7 @@ f_include $BSDCFG_SHARE/variable.subr
 #
 # Default name for the boot environment parent dataset
 #
-: ${ZFSBOOT_BEROOT_NAME:=bootenv}
+: ${ZFSBOOT_BEROOT_NAME:=ROOT}
 
 #
 # Default name for the primany boot environment
@@ -67,7 +67,7 @@ f_include $BSDCFG_SHARE/variable.subr
 #
 # Should we use geli(8) to encrypt the drives?
 #
-: ${ZFSBOOT_GELI_ENCRYPTION:=}
+: ${ZFSBOOT_GELI_ENCRYPTION=}
 
 #
 # Default name the unencrypted pool when using geli(8) to encrypt the drives
@@ -101,7 +101,7 @@ f_include $BSDCFG_SHARE/variable.subr
 : ${ZFSBOOT_SWAP_SIZE:=2g}
 
 #
-# Default ZFS layout for root zpool
+# Default ZFS datasets for root zpool
 #
 # NOTE: Requires /tmp, /var/tmp, /$ZFSBOOT_BOOTFS_NAME/$ZFSBOOT_BOOTFS_NAME
 # NOTE: Anything after pound/hash character [#] is ignored as a comment.
@@ -119,69 +119,110 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATA
 	# Don't mount /usr so that 'base' files go to the BEROOT
 	/usr		mountpoint=/usr,canmount=off
 
-	/usr/local # local files (i.e. from packages) separate from base system
-
 	# Home directories separated so they are common to all BEs
-	/usr/home	setuid=off
+	/usr/home	# NB: /home is a symlink to /usr/home
 
 	# Ports tree
 	/usr/ports		compression=lz4,setuid=off
-	/usr/ports/distfiles	compression=off,exec=off,setuid=off
-	/usr/ports/packages	compression=off,exec=off,setuid=off
 
 	# Source tree (compressed)
 	/usr/src	compression=lz4,exec=off,setuid=off
-	/usr/obj	# Object files
 
 	# Create /var and friends
 	/var		mountpoint=/var
 	/var/crash	compression=lz4,exec=off,setuid=off
-	/var/db		exec=off,setuid=off
-	/var/db/pkg	compression=lz4,exec=off,setuid=off
-	/var/empty	exec=off,setuid=off
 	/var/log	compression=lz4,exec=off,setuid=off
-	/var/mail	compression=lz4,exec=off,setuid=off
-	/var/run	exec=off,setuid=off
 	/var/tmp	compression=lz4,exec=on,setuid=off
 " # END-QUOTE
 
+#
+# If interactive and the user has not explicitly chosen a vdev type or disks,
+# make the user confirm scripted/default choices when proceeding to install.
+#
+: ${ZFSBOOT_CONFIRM_LAYOUT:=1}
+
 ############################################################ GLOBALS
 
 #
+# Format of a line in printf(1) syntax to add to fstab(5)
+#
+FSTAB_FMT="%s\t\t%s\t%s\t%s\t\t%s\t%s\n"
+
+#
+# Command strings for various tasks
+#
+CHMOD_MODE='chmod %s "%s"'
+DD_WITH_OPTIONS='dd if="%s" of="%s" %s'
+ECHO_APPEND='echo "%s" >> "%s"'
+GELI_ATTACH='geli attach -j - -k "%s" "%s"'
+GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 "%s"'
+GNOP_CREATE='gnop create -S 4096 "%s"'
+GPART_ADD='gpart add -t %s "%s"'
+GPART_ADD_INDEX='gpart add -i %s -t %s "%s"'
+GPART_ADD_INDEX_WITH_SIZE='gpart add -i %s -t %s -s %s "%s"'
+GPART_ADD_LABEL='gpart add -l %s -t %s "%s"'
+GPART_ADD_LABEL_WITH_SIZE='gpart add -l %s -t %s -s %s "%s"'
+GPART_BOOTCODE='gpart bootcode -b "%s" "%s"'
+GPART_BOOTCODE_PART='gpart bootcode -b "%s" -p "%s" -i %s "%s"'
+GPART_CREATE='gpart create -s %s "%s"'
+GPART_SET_ACTIVE='gpart set -a active -i %s "%s"'
+LN_SF='ln -sf "%s" "%s"'
+MKDIR_P='mkdir -p "%s"'
+MOUNT_TYPE='mount -t %s "%s" "%s"'
+PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\""
+PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"'
+SHELL_TRUNCATE=':> "%s"'
+ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"'
+ZFS_SET='zfs set "%s" "%s"'
+ZFS_UNMOUNT='zfs unmount "%s"'
+ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s'
+ZPOOL_EXPORT='zpool export "%s"'
+ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"'
+ZPOOL_SET='zpool set %s "%s"'
+
+#
 # Strings that should be moved to an i18n file and loaded with f_include_lang()
 #
 hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or ENTER"
 hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER"
 hline_arrows_tab_enter="Press arrows, TAB or ENTER"
+msg_an_unknown_error_occurred="An unknown error occurred"
 msg_back="Back"
 msg_cancel="Cancel"
-msg_change="Change Selection"
+msg_change_selection="Change Selection"
 msg_configure_options="Configure Options:"
-msg_create="Install"
-msg_create_desc="Proceed with Installation"
-msg_create_help="Create ZFS boot pool with displayed options"
 msg_detailed_disk_info="gpart(8) show %s:\n%s\n\ncamcontrol(8) inquiry %s:\n%s\n\n\ncamcontrol(8) identify %s:\n%s\n"
 msg_disk_info="Disk Info"
 msg_disk_info_help="Get detailed information on disk device(s)"
-msg_disks_to_use="Disks To Use"
-msg_disks_to_use_help="Choose which disks to use for the Virtual Device (Required)"
+msg_encrypt_disks="Encrypt Disks?"
+msg_encrypt_disks_help="Use geli(8) to encrypt all data partitions"
+msg_error="Error"
 msg_force_4k_sectors="Force 4K Sectors?"
 msg_force_4k_sectors_help="Use gnop(8) to configure forced 4K sector alignment"
 msg_freebsd_installer="FreeBSD Installer"
-msg_geli_encryption="Encrypt Disks?"
-msg_geli_encryption_help="Use geli(8) to encrypt all data partitions"
 msg_geli_password="Enter a strong passphrase, used to protect your encryption keys. You will be required to enter this passphrase each time the system is booted"
 msg_geli_setup="Initializing encryption on the selected disks, this will take several seconds per disk"
+msg_install="Install"
+msg_install_desc="Proceed with Installation"
+msg_install_help="Create ZFS boot pool with displayed options"
+msg_invalid_disk_argument="Invalid disk argument \`%s'"
+msg_invalid_geli_boot_size="Invalid geli(8) boot size \`%s'"
+msg_invalid_index_argument="Invalid index argument \`%s'"
+msg_invalid_swap_size="Invalid swap size \`%s'"
 msg_invalid_virtual_device_type="Invalid Virtual Device type \`%s'"
-msg_invalid_virtual_device_type_help="Select another Virtual Device type or Cancel to\nreturn to the ZFS menu. From there you can select\nmore disks or rescan for additional devices."
-msg_last_chance_are_you_sure="Last Chance! Are you sure you want to destroy the current contents of the following disks:\n%s"
-msg_last_chance_are_you_sure_color="\\\\ZrLast Chance!\\\\ZR Are you \\\\Z1sure\\\\Zn you want to \\\\Zr\\\\Z1destroy\\\\Zn the current contents of the following disks:\n%s"
+msg_last_chance_are_you_sure="Last Chance! Are you sure you want to destroy\nthe current contents of the following disks:\n\n   %s"
+msg_last_chance_are_you_sure_color='\\ZrLast Chance!\\ZR Are you \\Z1sure\\Zn you want to \\Zr\\Z1destroy\\Zn\nthe current contents of the following disks:\n\n   %s'
 msg_mirror_desc="Mirror - n-Way Mirroring"
 msg_mirror_help="[2+ Disks] Mirroring provides the best performance, but the least storage"
+msg_missing_disk_arguments="missing disk arguments"
+msg_missing_one_or_more_scripted_disks="Missing one or more scripted disks!"
 msg_no="NO"
 msg_no_disks_present_to_configure="No disk(s) present to configure"
 msg_no_disks_selected="No disks selected."
-msg_not_enough_disks_selected="Not enough disks selected. (%u < %u wanted)"
+msg_not_enough_disks_selected="Not enough disks selected. (%u < %u minimum)"
+msg_null_disk_argument="NULL disk argument"
+msg_null_index_argument="NULL index argument"
+msg_null_poolname="NULL poolname"
 msg_ok="OK"
 msg_partition_scheme="Partition Scheme"
 msg_partition_scheme_help="Toggle between GPT and MBR partitioning schemes"
@@ -191,6 +232,8 @@ msg_please_select_one_or_more_disks="Ple
 msg_pool_name="Pool Name"
 msg_pool_name_cannot_be_empty="Pool name cannot be empty."
 msg_pool_name_help="Customize the name of the zpool to be created (Required)"
+msg_pool_type_disks="Pool Type/Disks:"
+msg_pool_type_disks_help="Choose type of ZFS Virtual Device and disks to use (Required)"
 msg_processing_selection="Processing selection..."
 msg_raidz1_desc="RAID-Z1 - Single Redundant RAID"
 msg_raidz1_help="[3+ Disks] Withstand failure of 1 disk. Recommended for: 3, 5 or 9 disks"
@@ -207,11 +250,12 @@ msg_stripe_desc="Stripe - No Redundancy"
 msg_stripe_help="[1+ Disks] Striping provides maximum storage but no redundancy"
 msg_swap_size="Swap Size"
 msg_swap_size_help="Customize how much swap space is allocated to each selected disk"
-msg_these_disks_are_too_small="These disks are too small given the amount of requested\nswap (%s) and/or GELI (%s) partitions, which would take\n50%% or more (not recommended) of each of the following\nselected disk devices:\n\n  %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of devices."
+msg_these_disks_are_too_small="These disks are too small given the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 50%% or more of each of the following selected disk\ndevices (not recommended):\n\n  %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of devices."
+msg_unable_to_get_disk_capacity="Unable to get disk capacity of \`%s'"
+msg_unsupported_partition_scheme="%s is an unsupported partition scheme"
+msg_user_cancelled="User Cancelled."
 msg_yes="YES"
 msg_zfs_configuration="ZFS Configuration"
-msg_zfs_vdev_type="ZFS VDev Type"
-msg_zfs_vdev_type_help="Select type of ZFS Virtual Device to create"
 
 ############################################################ FUNCTIONS
 
@@ -228,26 +272,26 @@ dialog_menu_main()
 	local usegeli="$msg_no"
 	[ "$ZFSBOOT_GNOP_4K_FORCE_ALIGN" ] && force4k="$msg_yes"
 	[ "$ZFSBOOT_GELI_ENCRYPTION" ] && usegeli="$msg_yes"
+	local disks n=$( set -- $ZFSBOOT_DISKS; echo $# )
+	{ [ $n -eq 1 ] && disks=disk; } || disks=disks # grammar
 	local menu_list="
-		'>>> $msg_create'         '$msg_create_desc'
-		                          '$msg_create_help'
+		'>>> $msg_install'        '$msg_install_desc'
+		                          '$msg_install_help'
+		'T $msg_pool_type_disks'  '$ZFSBOOT_VDEV_TYPE: $n $disks'
+                                          '$msg_pool_type_disks_help'
 		'- $msg_rescan_devices'   '*'
 		                          '$msg_rescan_devices_help'
 		'- $msg_disk_info'        '*'
 		                          '$msg_disk_info_help'
-		'1 $msg_pool_name'        '$ZFSBOOT_POOL_NAME'
+		'N $msg_pool_name'        '$ZFSBOOT_POOL_NAME'
 		                          '$msg_pool_name_help'
-		'2 $msg_disks_to_use'     '$ZFSBOOT_DISKS'
-		                          '$msg_disks_to_use_help'
-		'3 $msg_zfs_vdev_type'    '$ZFSBOOT_VDEV_TYPE'
-		                          '$msg_zfs_vdev_type_help'
 		'4 $msg_force_4k_sectors' '$force4k'
 		                          '$msg_force_4k_sectors_help'
-		'5 $msg_geli_encryption'  '$usegeli'
-		                          '$msg_geli_encryption_help'
-		'6 $msg_partition_scheme' '$ZFSBOOT_PARTITION_SCHEME'
+		'E $msg_encrypt_disks'    '$usegeli'
+		                          '$msg_encrypt_disks_help'
+		'P $msg_partition_scheme' '$ZFSBOOT_PARTITION_SCHEME'
 		                          '$msg_partition_scheme_help'
-		'7 $msg_swap_size'        '$ZFSBOOT_SWAP_SIZE'
+		'S $msg_swap_size'        '$ZFSBOOT_SWAP_SIZE'
 		                          '$msg_swap_size_help'
 	" # END-QUOTE
 	local defaultitem= # Calculated below
@@ -284,158 +328,279 @@ dialog_menu_main()
 	return $retval
 }
 
-# dialog_edit_disks
+# dialog_last_chance $disks ...
 #
-# Edit the list of disks to be used by the ZFS boot pool.
+# Display a list of the disks that the user is about to destroy. The default
+# action is to return error status unless the user explicitly (non-default)
+# selects "Yes" from the noyes dialog.
 #
-dialog_edit_disks()
+dialog_last_chance()
 {
 	local title="$DIALOG_TITLE"
 	local btitle="$DIALOG_BACKTITLE"
-	local prompt="$msg_please_select_one_or_more_disks"
-	local check_list= # Calculated below
-	local hline="$hline_arrows_space_tab_enter"
-	local dev vardev disks=
+	local prompt # Calculated below
+	local hline="$hline_arrows_tab_enter"
 
-	#
-	# Get a [new] list of disk devices
-	#
-	f_device_find "" $DEVICE_TYPE_DISK disks
-	if [ ! "$disks" ]; then
-		f_show_msg "$msg_no_disks_present_to_configure"
-		return $FAILURE
+	local height=8 width=50 prefix="   "
+	local plen=${#prefix} list= line=
+	local max_width=$(( $width - 3 - $plen ))
+
+	local yes no defaultno extra_args format

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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