From owner-svn-src-all@FreeBSD.ORG Mon Mar 31 01:04:44 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 81A0AC11; Mon, 31 Mar 2014 01:04:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (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 6C91BDC; Mon, 31 Mar 2014 01:04:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2V14itN088793; Mon, 31 Mar 2014 01:04:44 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2V14fvE088770; Mon, 31 Mar 2014 01:04:41 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201403310104.s2V14fvE088770@svn.freebsd.org> From: Devin Teske Date: Mon, 31 Mar 2014 01:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r263956 - in stable/9: release usr.sbin/bsdinstall usr.sbin/bsdinstall/scripts X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Mar 2014 01:04:44 -0000 Author: dteske Date: Mon Mar 31 01:04:40 2014 New Revision: 263956 URL: http://svnweb.freebsd.org/changeset/base/263956 Log: MFC revisions 230804,254265,255908,256338,256345,256347-256348,256489, 257842-257845,257872,259115,259143,259276,259468-259469,259572,259686, 260260-260262,260866, and 260900 (25 revisions; summarized below)... r230804: Fix a whitespace nit (kevlo) r254265: (recording mergeinfo only) r255908: Remove the is (Iceland) mirror per mail from the admins (brd) r256338: Dump 4096 bytes from /dev/random to /entropy (des) r256345: Rewrite the keymap module r256347: Detect when an interface is wireless (Warren Block) r256348: Merge dumpdev into regular services; enable (Allan Jude) r256489: Add executable bit to docsinstall and entropy scripts r257842: Performance and debugging enhancements r257843: Remove ttys(5) munging from previous commit r257844: Copy install log to deployed /var/log for debugging r257845: Fixup to last commit r257872: Doc fixup -- add missing .El (joel) r259115: Prevent log file from becoming truncated r259143: Use sed(1) /i instead of /I (eadler) r259276: Fix `local: Not in a function' error in logfile r259468: Ignore mouse-release command from VMware r259469: Mask error from newaliases(1) when hostname not fully qualified r259572: Fix `rm: /tmp/bsdinstall_etc/fstab: ..." error in logfile r259686: Move VMware mouse-release solution r260260: Remove what appears to be a stray debugging printf r260261: Lower priority of open wireless access policy (gavin) r260262: Allow bsdinstall to use WPA-Enterprise networks (gavin) r260866: Fix bad comparison and fix file comment (Christoph Mallon) r260900: Whitespace and style nits Added: - copied unchanged from r256338, head/usr.sbin/bsdinstall/scripts/entropy Directory Properties: stable/9/usr.sbin/bsdinstall/scripts/entropy (props changed) Modified: stable/9/release/rc.local stable/9/usr.sbin/bsdinstall/bsdinstall stable/9/usr.sbin/bsdinstall/bsdinstall.8 stable/9/usr.sbin/bsdinstall/scripts/Makefile stable/9/usr.sbin/bsdinstall/scripts/auto stable/9/usr.sbin/bsdinstall/scripts/config stable/9/usr.sbin/bsdinstall/scripts/docsinstall (contents, props changed) stable/9/usr.sbin/bsdinstall/scripts/jail stable/9/usr.sbin/bsdinstall/scripts/keymap stable/9/usr.sbin/bsdinstall/scripts/mirrorselect stable/9/usr.sbin/bsdinstall/scripts/netconfig stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv4 stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv6 stable/9/usr.sbin/bsdinstall/scripts/script stable/9/usr.sbin/bsdinstall/scripts/services stable/9/usr.sbin/bsdinstall/scripts/wlanconfig Directory Properties: stable/9/ (props changed) stable/9/release/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/bsdinstall/ (props changed) stable/9/usr.sbin/bsdinstall/scripts/ (props changed) Modified: stable/9/release/rc.local ============================================================================== --- stable/9/release/rc.local Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/release/rc.local Mon Mar 31 01:04:40 2014 (r263956) @@ -19,6 +19,10 @@ if [ $? -eq 0 ]; then TERM=xterm fi + # Don't send ESC on function-key 62/63 (left/right command key) + kbdcontrol -f 62 '' > /dev/null 2>&1 + kbdcontrol -f 63 '' > /dev/null 2>&1 + if [ -z "$EXTERNAL_VTY_STARTED" ]; then # Init will clean these processes up if/when the system # goes multiuser Modified: stable/9/usr.sbin/bsdinstall/bsdinstall ============================================================================== --- stable/9/usr.sbin/bsdinstall/bsdinstall Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/bsdinstall Mon Mar 31 01:04:40 2014 (r263956) @@ -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,15 +26,61 @@ # 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= +export DEBUG_INITIALIZE_FILE= + +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 : ${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" -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/9/usr.sbin/bsdinstall/bsdinstall.8 ============================================================================== --- stable/9/usr.sbin/bsdinstall/bsdinstall.8 Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/bsdinstall.8 Mon Mar 31 01:04:40 2014 (r263956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2013 +.Dd October 6, 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 @@ -60,6 +73,10 @@ targets. .Bl -tag -width ".Cm jail Ar destination" .It Cm auto Run the standard interactive installation, including disk partitioning. +.It Cm entropy +Reads a small amount of data from +.Pa /dev/random +and stores it in a file in the new system's root directory. .It Cm jail Ar destination Sets up a new chroot system at .Pa destination , Modified: stable/9/usr.sbin/bsdinstall/scripts/Makefile ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/Makefile Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/Makefile Mon Mar 31 01:04:40 2014 (r263956) @@ -1,8 +1,8 @@ # $FreeBSD$ -SCRIPTS= auto adduser checksum config docsinstall hostname jail keymap \ - mirrorselect mount netconfig netconfig_ipv4 netconfig_ipv6 rootpass \ - script services time umount wlanconfig +SCRIPTS= auto adduser checksum config docsinstall entropy hostname jail \ + keymap mirrorselect mount netconfig netconfig_ipv4 netconfig_ipv6 \ + rootpass script services time umount wlanconfig BINDIR= /usr/libexec/bsdinstall NO_MAN= true Modified: stable/9/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/auto Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/auto Mon Mar 31 01:04:40 2014 (r263956) @@ -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 @@ -90,7 +99,7 @@ if [ -n "$FETCH_DISTRIBUTIONS" ]; then export BSDINSTALL_DISTSITE fi -rm $PATH_FSTAB +rm -f $PATH_FSTAB touch $PATH_FSTAB dialog --backtitle "FreeBSD Installer" --title "Partitioning" --extra-button \ @@ -108,7 +117,12 @@ case $? in sh 2>&1 ;; 3) # 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 ;; *) @@ -222,5 +236,11 @@ if [ $? -eq 0 ]; then chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1 fi -echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG +bsdinstall entropy +bsdinstall umount + +f_dprintf "Installation Completed at %s" "$( date )" +################################################################################ +# END +################################################################################ Modified: stable/9/usr.sbin/bsdinstall/scripts/config ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/config Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/config Mon Mar 31 01:04:40 2014 (r263956) @@ -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,12 +26,19 @@ # SUCH DAMAGE. # # $FreeBSD$ +# +############################################################ MAIN cat $BSDINSTALL_TMPETC/rc.conf.* >> $BSDINSTALL_TMPETC/rc.conf rm $BSDINSTALL_TMPETC/rc.conf.* cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc +[ "${debugFile#+}" ] && cp "${debugFile#+}" $BSDINSTALL_CHROOT/var/log/ + # Set up other things from installed config -chroot $BSDINSTALL_CHROOT /usr/bin/newaliases +chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 +################################################################################ +# END +################################################################################ Modified: stable/9/usr.sbin/bsdinstall/scripts/docsinstall ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/docsinstall Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/docsinstall Mon Mar 31 01:04:40 2014 (r263956) @@ -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,55 +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 -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>&- +############################################################ CONFIGURATION -# Let pkg_add be able to use name servers -cp ${BSDINSTALL_TMPETC}/resolv.conf ${BSDINSTALL_CHROOT}/etc +# +# 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 -error() { - dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox \ - "Could not install package $1 (`tail -n 1 ${BSDINSTALL_LOG}`)" 0 0 - exit 1 +# +# 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 } +############################################################ MAIN + +# +# Initialize +# +f_dialog_title "$msg_freebsd_documentation_installation" +f_dialog_backtitle "$msg_freebsd_installer" +f_mustberoot_init -clear -echo "FreeBSD Installer" -echo "========================" -echo +# +# Launch application main menu +# +dialog_menu_main || f_die +f_dialog_menutag_fetch selected -for i in $DOCS; do - pkg_add -C ${BSDINSTALL_CHROOT} -r ${i}-freebsd-doc || error $i-freebsd-doc +# 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 +################################################################################ Copied: stable/9/usr.sbin/bsdinstall/scripts/entropy (from r256338, head/usr.sbin/bsdinstall/scripts/entropy) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/bsdinstall/scripts/entropy Mon Mar 31 01:04:40 2014 (r263956, copy of r256338, head/usr.sbin/bsdinstall/scripts/entropy) @@ -0,0 +1,29 @@ +#!/bin/sh +#- +# Copyright (c) 2013 Dag-Erling Smørgrav +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +dd if=/dev/random of=$BSDINSTALL_CHROOT/entropy bs=4096 count=1 Modified: stable/9/usr.sbin/bsdinstall/scripts/jail ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/jail Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/jail Mon Mar 31 01:04:40 2014 (r263956) @@ -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 -echo "Begun Installation at $(date)" > $BSDINSTALL_LOG +############################################################ MAIN + +f_dprintf "Began Installation at %s" "$( date )" export BSDINSTALL_CHROOT=$1 error() { @@ -110,5 +118,10 @@ bsdinstall config || error cp /etc/resolv.conf $1/etc cp /etc/localtime $1/etc -echo "Installation Completed at $(date)" >> $BSDINSTALL_LOG +bsdinstall entropy + +f_dprintf "Installation Completed at %s" "$(date)" +################################################################################ +# END +################################################################################ Modified: stable/9/usr.sbin/bsdinstall/scripts/keymap ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/keymap Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/keymap Mon Mar 31 01:04:40 2014 (r263956) @@ -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,11 +26,212 @@ # 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/keymap.subr +f_include $BSDCFG_SHARE/sysrc.subr + +############################################################ CONFIGURATION + +# +# Default file to store keymap selection in +# +: ${KEYMAPFILE:=$BSDINSTALL_TMPETC/rc.conf.keymap} + +# +# Default path to keymap INDEX containing descriptions +# +: ${MAPDESCFILE:=/usr/share/syscons/keymaps/INDEX.keymaps} + +############################################################ GLOBALS + +# +# Strings that should be moved to an i18n file and loaded with f_include_lang() +# +hline_arrows_tab_enter="Press arrows, TAB or ENTER" +msg_continue_with_keymap="Continue with %s keymap" +msg_default="default" +msg_error="Error" +msg_freebsd_installer="FreeBSD Installer" +msg_keymap_menu_text="The system console driver for FreeBSD defaults to standard \"US\"\nkeyboard map. Other keymaps can be chosen below." +msg_keymap_selection="Keymap Selection" +msg_ok="OK" +msg_select="Select" +msg_test_keymap="Test %s keymap" +msg_test_the_currently_selected_keymap="Test the currently selected keymap" +msg_test_the_keymap_by_typing="Test the keymap by typing letters, numbers, and symbols. Characters\nshould match labels on the keyboard keys. Press Enter to stop testing." + +############################################################ FUNCTIONS + +# dialog_keymap_test $keymap +# +# Activate $keymap and display an input box (without cancel button) for the +# user to test keyboard input and return. Always returns success. +# +dialog_keymap_test() +{ + local keym="$1" + local title= # Calculated below + local btitle= # Calculated below + local prompt="$msg_test_the_keymap_by_typing" + local hline= + + # Attempt to activate the keymap + if [ "$keym" ]; then + local err + err=$( f_keymap_kbdcontrol "$keym" 2>&1 > /dev/null ) + if [ "$err" ]; then + f_dialog_title "$msg_error" + f_dialog_msgbox "$err" + f_dialog_title_restore + return $FAILURE + fi + fi + + f_dialog_title "$( printf "$msg_test_keymap" "${keym:-$msg_default}" )" + title="$DIALOG_TITLE" + btitle="$DIALOG_BACKTITLE" + f_dialog_title_restore + + local height width + f_dialog_inputbox_size height width \ + "$title" "$btitle" "$prompt" "" "$hline" + + $DIALOG \ + --title "$title" \ + --backtitle "$btitle" \ + --hline "$hline" \ + --ok-label "$msg_ok" \ + --no-cancel \ + --inputbox "$prompt" \ + $height $width \ + 2>/dev/null >&$DIALOG_TERMINAL_PASSTHRU_FD -kbdcontrol -d >/dev/null 2>&1 -if [ $? -eq 0 ]; then - dialog --backtitle "FreeBSD Installer" --title "Keymap Selection" \ - --yesno "Would you like to set a non-default key mapping for your keyboard?" 0 0 || exit 0 - exec 3>&1 - kbdmap 2>&1 1>&3 | grep 'keymap=' > $BSDINSTALL_TMPETC/rc.conf.keymap + return $DIALOG_OK +} + +############################################################ MAIN + +# +# Initialize +# +f_dialog_title "$msg_keymap_selection" +f_dialog_backtitle "$msg_freebsd_installer" + +# +# Die immediately if we can't dump the current keyboard map +# +#error=$( kbdcontrol -d 2>&1 > /dev/null ) || f_die $FAILURE "%s" "$error" + +# Capture Ctrl-C for clean-up +trap 'rm -f $KEYMAPFILE; exit $FAILURE' SIGINT + +# Get a value from rc.conf(5) as initial value (if not being scripted) +f_getvar $VAR_KEYMAP keymap +if [ ! "$keymap" ]; then + keymap=$( f_sysrc_get keymap ) + case "$keymap" in [Nn][Oo]) keymap="";; esac fi + +# +# Loop until the user has finalized their selection (by clicking the +# [relabeled] Cancel button). +# +width=67 first_pass=1 back_from_testing= +[ "$USE_XDIALOG" ] && width=70 +prompt="$msg_keymap_menu_text" +hline="$hline_arrows_tab_enter" +while :; do + # + # Re/Build list of keymaps + # + cont_msg=$( printf "$msg_continue_with_keymap" \ + "${keymap:-$msg_default}" ) + test_msg=$( printf "$msg_test_keymap" "${keymap:-$msg_default}" ) + menu_list=" + '>>> $cont_msg' '' '$msg_continue_with_current_keymap' + '->- $test_msg' '' '$msg_test_the_currently_selected_keymap' + " # END-QUOTE + if [ "$first_pass" ]; then + defaultitem= + first_pass= + else + defaultitem="->- $test_msg" + fi + for k in $KEYMAPS; do + keymap_$k get keym keym + keymap_$k get desc desc + radio=" " + if [ "$keym" = "$keymap" ]; then + radio="*" + if [ "$back_from_testing" ]; then + defaultitem="(*) $desc" + back_from_testing= + fi + fi + f_shell_escape "$desc" desc + menu_list="$menu_list + '($radio) $desc' '' '$keym: $desc' + " # END-QUOTE + done + back_from_testing= + + # + # Display keymap configuration menu + # + eval f_dialog_menu_with_help_size height \"\" rows \ + \"\$DIALOG_TITLE\" \ + \"\$DIALOG_BACKTITLE\" \ + \"\$prompt\" \ + \"\$hline\" \ + $menu_list + menu_choice=$( eval $DIALOG \ + --title \"\$DIALOG_TITLE\" \ + --backtitle \"\$DIALOG_BACKTITLE\" \ + --hline \"\$hline\" \ + --keep-tite \ + --item-help \ + --ok-label \"\$msg_select\" \ + --cancel-label \"\$msg_cancel\" \ + --default-item \"\$defaultitem\" \ + --menu \"\$prompt\" \ + $height $width $rows \ + $menu_list \ + 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD + ) || { + f_quietly rm -f "$KEYMAPFILE" + exit $FAILURE # Exit with an error so bsdinstall restarts + } + f_dialog_data_sanitize menu_choice + + case "$menu_choice" in + ">>> "*) # Continue with keymap + break ;; + "->-"*) # Test keymap + dialog_keymap_test "$keymap" + back_from_testing=1 + continue ;; + esac + + # Turn the user's choice into a number + n=$( eval f_dialog_menutag2index_with_help \ + \"\$menu_choice\" $menu_list ) + + # Turn that number ithe name of the keymap struct + k=$( set -- $KEYMAPS; eval echo \"\${$(( $n - 2))}\" ) + + # Get actual keymap setting while we update $keymap and $KEYMAPFILE + keymap_$k get keym keymap + echo "keymap=\"$keymap\"" > "$KEYMAPFILE" +done + +f_quietly f_keymap_kbdcontrol "$keymap" + +################################################################################ +# END +################################################################################ Modified: stable/9/usr.sbin/bsdinstall/scripts/mirrorselect ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/mirrorselect Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/mirrorselect Mon Mar 31 01:04:40 2014 (r263956) @@ -87,7 +87,6 @@ MIRROR=`dialog --backtitle "FreeBSD Inst ftp://ftp8.de.freebsd.org "Germany #8"\ ftp://ftp.gr.freebsd.org "Greece"\ ftp://ftp2.gr.freebsd.org "Greece #2"\ - ftp://ftp.is.freebsd.org "Iceland"\ ftp://ftp3.ie.freebsd.org "Ireland #3"\ ftp://ftp.il.freebsd.org "Israel"\ ftp://ftp.it.freebsd.org "Italy"\ Modified: stable/9/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/netconfig Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/netconfig Mon Mar 31 01:04:40 2014 (r263956) @@ -41,11 +41,19 @@ DIALOG_TAGS="" : ${DIALOG_ITEM_HELP=4} : ${DIALOG_ESC=255} +# Do a dirty check to see if this a wireless interface -- there should be a +# better way +is_wireless_if() { + ifconfig $1 | grep -q 'media: IEEE 802.11 Wireless' +} + for IF in `ifconfig -l`; do test "$IF" = "lo0" && continue (ifconfig -g wlan | egrep -wq $IF) && continue INTERFACES="$INTERFACES $IF" DESC=`sysctl -n dev.$(echo $IF | sed -E 's/([[:alpha:]]*)([[:digit:]]*)/\1.\2/g').%desc` + is_wireless_if $IF && echo $DESC | + grep -iqv wireless && DESC="Wireless $DESC" DIALOG_TAGS="$DIALOG_TAGS $IF \"$DESC\"" done @@ -63,10 +71,8 @@ exec 3>&- : > $BSDINSTALL_TMPETC/._rc.conf.net -# Do a dirty check to see if this a wireless interface -- there should be a -# better way IFCONFIG_PREFIX="" -if ifconfig $INTERFACE | grep -q 'media: IEEE 802.11 Wireless'; then +if is_wireless_if $INTERFACE; then NEXT_WLAN_IFACE=wlan0 # XXX echo wlans_$INTERFACE=\"$NEXT_WLAN_IFACE\" >> $BSDINSTALL_TMPETC/._rc.conf.net IFCONFIG_PREFIX="WPA " Modified: stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Mon Mar 31 01:04:40 2014 (r263956) @@ -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 @@ -73,7 +77,7 @@ exec 3>&- echo $INTERFACE $IF_CONFIG | awk -v prefix="$IFCONFIG_PREFIX" '{ - printf("ifconfig_%s=\"%s inet %s netmask %s\"\n", $1, prefix, $2, $3); + printf("ifconfig_%s=\"%s\inet %s netmask %s\"\n", $1, prefix, $2, $3); printf("defaultrouter=\"%s\"\n", $4); }' >> $BSDINSTALL_TMPETC/._rc.conf.net @@ -86,3 +90,6 @@ if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; t fi fi +################################################################################ +# END +################################################################################ Modified: stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Mon Mar 31 01:04:40 2014 (r263956) @@ -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/9/usr.sbin/bsdinstall/scripts/script ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/script Mon Mar 31 00:28:54 2014 (r263955) +++ stable/9/usr.sbin/bsdinstall/scripts/script Mon Mar 31 01:04:40 2014 (r263956) @@ -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 @@ -83,8 +120,13 @@ if [ -f /tmp/bsdinstall-installscript-ab rm $BSDINSTALL_CHROOT/tmp/installscript fi +bsdinstall entropy bsdinstall umount *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***