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
This commit is contained in:
Devin Teske 2013-11-08 09:57:03 +00:00
parent 09c7b5a460
commit bc4a673f89
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257842
11 changed files with 1112 additions and 453 deletions

View File

@ -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
################################################################################

View File

@ -33,6 +33,7 @@
.Nd system installer
.Sh SYNOPSIS
.Nm
.Op Ar options
.Op Ar target
.Op Ar ...
.Sh DESCRIPTION
@ -49,6 +50,17 @@ invoked with no arguments, it will invoke the
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 .
.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

View File

@ -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
echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
############################################################ 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
################################################################################

View File

@ -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,83 @@
# SUCH DAMAGE.
#
# $FreeBSD$
#
############################################################ CONFIGURATION
#
# Location of ttys(5)
#
ETC_TTYS=/etc/ttys
############################################################ FUNCTIONS
# ttus_set_type $serterm
#
# Set terminal type of `ttyu*' and entries in ttys(5) to $serterm.
#
ttus_set_type()
{
local serterm="$1" err
#
# Create new temporary file to write our ttys(5) update with new types.
#
local tmpfile="$( mktemp -t "pgm" )"
[ "$tmpfile" ] || return $FAILURE
#
# Fixup permissions and ownership (mktemp(1) creates the temporary file
# with 0600 permissions -- change the permissions and ownership to
# match ttys(5) before we write it out and mv(1) it into place).
#
local mode="$( stat -f '%#Lp' "$ETC_TTYS" 2> /dev/null )"
local owner="$( stat -f '%u:%g' "$ETC_TTYS" 2> /dev/null )"
f_quietly chmod "${mode:-0644}" "$tmpfile"
f_quietly chown "${owner:-root:wheel}" "$tmpfile"
#
# Operate on ttys(5), replacing only the types of `ttyu*' terminals
# with the new type.
#
if ! err=$( awk -v serterm="$serterm" '
BEGIN {
}
{
# "Skip" blank-lines, lines containing only whitespace, and
# lines containing only a comment or whitespace-then-comment.
#
if ( $0 ~ /^[[:space:]]*(#|$)/ ) { print; next }
# "Skip" terminal types other than those supported
#
if ( $1 !~ /^ttyu.*$/ ) { print; next }
# Change the terminal type to the new value and enable it
#
match($0,
/[[:alnum:]\.\+-_]+[[:space:]]+(on|off)([[:space:]]|$).*$/)
if ( ! RSTART ) { print; next }
start = RSTART
left=substr($0, 0, RSTART - 1)
right=substr($0, start)
match(right,
/[[:alnum:]\.\+-_]+[[:space:]]+(on|off)([[:space:]]+|$)/)
right=substr(right, RSTART + RLENGTH)
printf "%s%s on %s\n", left, serterm, right
}
' "$ETC_TTYS" > "$tmpfile" 2>&1 ); then
f_show_err "%s" "$err"
return $FAILURE
fi
if ! err=$( mv -f "$tmpfile" "$ETC_TTYS" 2>&1 ); then
f_show_err "%s" "$err"
return $FAILURE
fi
return $SUCCESS
}
############################################################ MAIN
cat $BSDINSTALL_TMPETC/rc.conf.* >> $BSDINSTALL_TMPETC/rc.conf
rm $BSDINSTALL_TMPETC/rc.conf.*
@ -39,3 +117,8 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot
# Set up other things from installed config
chroot $BSDINSTALL_CHROOT /usr/bin/newaliases
kbdcontrol -d || ttus_set_type vt100
################################################################################
# END
################################################################################

View File

@ -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
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(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
clear
echo "FreeBSD Installer"
echo "========================"
echo
#
# 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"
echo "Please wait while the repository metadata is fetched."
echo "This may take a few moments."
############################################################ FUNCTIONS
env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install pkg \
|| error pkg
# 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"
for i in $DOCS; do
env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install ${i}-freebsd-doc \
|| error $i-freebsd-doc
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
#
# 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
################################################################################

View File

@ -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
echo "Begun Installation at $(date)" > $BSDINSTALL_LOG
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
############################################################ MAIN
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
################################################################################

View File

@ -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
: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
############################################################ 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 ]; then
fi
fi
################################################################################
# END
################################################################################

View File

@ -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 ]; then
fi
fi
################################################################################
# END
################################################################################

View File

@ -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/bsdinstall-installscript-
: ${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
################################################################################

View File

@ -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_CONFIGCURRENT ]; then
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
################################################################################

File diff suppressed because it is too large Load Diff