auto revision 302320
1218799Snwhitehorn#!/bin/sh 2218799Snwhitehorn#- 3218799Snwhitehorn# Copyright (c) 2011 Nathan Whitehorn 4257842Sdteske# Copyright (c) 2013 Devin Teske 5218799Snwhitehorn# All rights reserved. 6218799Snwhitehorn# 7218799Snwhitehorn# Redistribution and use in source and binary forms, with or without 8218799Snwhitehorn# modification, are permitted provided that the following conditions 9218799Snwhitehorn# are met: 10218799Snwhitehorn# 1. Redistributions of source code must retain the above copyright 11218799Snwhitehorn# notice, this list of conditions and the following disclaimer. 12218799Snwhitehorn# 2. Redistributions in binary form must reproduce the above copyright 13218799Snwhitehorn# notice, this list of conditions and the following disclaimer in the 14218799Snwhitehorn# documentation and/or other materials provided with the distribution. 15218799Snwhitehorn# 16218799Snwhitehorn# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17218799Snwhitehorn# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18218799Snwhitehorn# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19218799Snwhitehorn# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20218799Snwhitehorn# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21218799Snwhitehorn# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22218799Snwhitehorn# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23218799Snwhitehorn# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24218799Snwhitehorn# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25218799Snwhitehorn# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26218799Snwhitehorn# SUCH DAMAGE. 27218799Snwhitehorn# 28218799Snwhitehorn# $FreeBSD: head/usr.sbin/bsdinstall/scripts/auto 302320 2016-07-03 01:23:38Z allanjude $ 29257842Sdteske# 30257842Sdteske############################################################ INCLUDES 31218799Snwhitehorn 32257842SdteskeBSDCFG_SHARE="/usr/share/bsdconfig" 33257842Sdteske. $BSDCFG_SHARE/common.subr || exit 1 34285679Sallanjudef_include $BSDCFG_SHARE/dialog.subr 35218799Snwhitehorn 36257842Sdteske############################################################ FUNCTIONS 37257842Sdteske 38218799Snwhitehornerror() { 39269653Sthompsa local msg 40269653Sthompsa if [ -n "$1" ]; then 41269653Sthompsa msg="$1\n\n" 42269653Sthompsa fi 43220088Snwhitehorn test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR 44220088Snwhitehorn test -f $PATH_FSTAB && bsdinstall umount 45218799Snwhitehorn dialog --backtitle "FreeBSD Installer" --title "Abort" \ 46218799Snwhitehorn --no-label "Exit" --yes-label "Restart" --yesno \ 47269653Sthompsa "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0 48218799Snwhitehorn if [ $? -ne 0 ]; then 49225637Snwhitehorn exit 1 50218799Snwhitehorn else 51218799Snwhitehorn exec $0 52218799Snwhitehorn fi 53218799Snwhitehorn} 54218799Snwhitehorn 55285679Sallanjudehline_arrows_tab_enter="Press arrows, TAB or ENTER" 56285732Sallanjudemsg_gpt_active_fix="Your hardware is known to have issues booting in CSM/Legacy/BIOS mode from GPT partitions that are not set active. Would you like the installer to apply this workaround for you?" 57285679Sallanjudemsg_lenovo_fix="Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?" 58285679Sallanjudemsg_no="NO" 59285679Sallanjudemsg_yes="YES" 60285679Sallanjude 61285679Sallanjude# dialog_workaround 62285679Sallanjude# 63285679Sallanjude# Ask the user if they wish to apply a workaround 64285679Sallanjude# 65285679Sallanjudedialog_workaround() 66285679Sallanjude{ 67285679Sallanjude local passed_msg="$1" 68285679Sallanjude local title="$DIALOG_TITLE" 69285679Sallanjude local btitle="$DIALOG_BACKTITLE" 70285679Sallanjude local prompt # Calculated below 71285679Sallanjude local hline="$hline_arrows_tab_enter" 72285679Sallanjude 73285679Sallanjude local height=8 width=50 prefix=" " 74285679Sallanjude local plen=${#prefix} list= line= 75285679Sallanjude local max_width=$(( $width - 3 - $plen )) 76285679Sallanjude 77285679Sallanjude local yes no defaultno extra_args format 78285679Sallanjude if [ "$USE_XDIALOG" ]; then 79285679Sallanjude yes=ok no=cancel defaultno=default-no 80285679Sallanjude extra_args="--wrap --left" 81285679Sallanjude format="$passed_msg" 82285679Sallanjude else 83285679Sallanjude yes=yes no=no defaultno=defaultno 84285679Sallanjude extra_args="--cr-wrap" 85285679Sallanjude format="$passed_msg" 86285679Sallanjude fi 87285679Sallanjude 88285679Sallanjude # Add height for Xdialog(1) 89285679Sallanjude [ "$USE_XDIALOG" ] && height=$(( $height + $height / 5 + 3 )) 90285679Sallanjude 91285679Sallanjude prompt=$( printf "$format" ) 92285679Sallanjude f_dprintf "%s: Workaround prompt" "$0" 93285679Sallanjude $DIALOG \ 94285679Sallanjude --title "$title" \ 95285679Sallanjude --backtitle "$btitle" \ 96285679Sallanjude --hline "$hline" \ 97285679Sallanjude --$yes-label "$msg_yes" \ 98285679Sallanjude --$no-label "$msg_no" \ 99285679Sallanjude $extra_args \ 100285679Sallanjude --yesno "$prompt" $height $width 101285679Sallanjude} 102285679Sallanjude 103257842Sdteske############################################################ MAIN 104218799Snwhitehorn 105257842Sdteskef_dprintf "Began Installation at %s" "$( date )" 106257842Sdteske 107218799Snwhitehornrm -rf $BSDINSTALL_TMPETC 108218799Snwhitehornmkdir $BSDINSTALL_TMPETC 109218799Snwhitehorn 110218799Snwhitehorntrap true SIGINT # This section is optional 111218799Snwhitehornbsdinstall keymap 112218799Snwhitehorn 113218799Snwhitehorntrap error SIGINT # Catch cntrl-C here 114269653Sthompsabsdinstall hostname || error "Set hostname failed" 115218799Snwhitehorn 116219615Snwhitehornexport DISTRIBUTIONS="base.txz kernel.txz" 117219615Snwhitehornif [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then 118293223Sgjb DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST` 119293223Sgjb DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')" 120218947Snwhitehorn 121219615Snwhitehorn exec 3>&1 122241902Sdteske EXTRA_DISTS=$( eval dialog \ 123241902Sdteske --backtitle \"FreeBSD Installer\" \ 124241902Sdteske --title \"Distribution Select\" --nocancel --separate-output \ 125241902Sdteske --checklist \"Choose optional system components to install:\" \ 126241902Sdteske 0 0 0 $DISTMENU \ 127241902Sdteske 2>&1 1>&3 ) 128219615Snwhitehorn for dist in $EXTRA_DISTS; do 129219615Snwhitehorn export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz" 130219615Snwhitehorn done 131219615Snwhitehornfi 132218947Snwhitehorn 133293223SgjbLOCAL_DISTRIBUTIONS="MANIFEST" 134218799SnwhitehornFETCH_DISTRIBUTIONS="" 135218799Snwhitehornfor dist in $DISTRIBUTIONS; do 136218799Snwhitehorn if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then 137218799Snwhitehorn FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist" 138293223Sgjb else 139293223Sgjb LOCAL_DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS $dist" 140218799Snwhitehorn fi 141218799Snwhitehorndone 142293223SgjbLOCAL_DISTRIBUTIONS=`echo $LOCAL_DISTRIBUTIONS` # Trim white space 143220080SnwhitehornFETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS` # Trim white space 144218799Snwhitehorn 145220080Snwhitehornif [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then 146293223Sgjb dialog --backtitle "FreeBSD Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0 147218799Snwhitehorn bsdinstall netconfig || error 148218799Snwhitehorn NETCONFIG_DONE=yes 149218799Snwhitehornfi 150218799Snwhitehorn 151220088Snwhitehornif [ -n "$FETCH_DISTRIBUTIONS" ]; then 152220080Snwhitehorn exec 3>&1 153220834Snwhitehorn BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3) 154220080Snwhitehorn MIRROR_BUTTON=$? 155220080Snwhitehorn exec 3>&- 156269653Sthompsa test $MIRROR_BUTTON -eq 0 || error "No mirror selected" 157220080Snwhitehorn export BSDINSTALL_DISTSITE 158220080Snwhitehornfi 159220080Snwhitehorn 160259572Sdteskerm -f $PATH_FSTAB 161218799Snwhitehorntouch $PATH_FSTAB 162218799Snwhitehorn 163285679Sallanjude# 164285679Sallanjude# Try to detect known broken platforms and apply their workarounds 165285679Sallanjude# 166285679Sallanjude 167285679Sallanjudeif f_interactive; then 168285679Sallanjude sys_maker=$( kenv -q smbios.system.maker ) 169285679Sallanjude f_dprintf "smbios.system.maker=[%s]" "$sys_maker" 170285679Sallanjude sys_model=$( kenv -q smbios.system.product ) 171285679Sallanjude f_dprintf "smbios.system.product=[%s]" "$sys_model" 172285679Sallanjude sys_version=$( kenv -q smbios.system.version ) 173285679Sallanjude f_dprintf "smbios.system.version=[%s]" "$sys_version" 174285732Sallanjude sys_mb_maker=$( kenv -q smbios.planar.maker ) 175285732Sallanjude f_dprintf "smbios.planar.maker=[%s]" "$sys_mb_maker" 176285732Sallanjude sys_mb_product=$( kenv -q smbios.planar.product ) 177285732Sallanjude f_dprintf "smbios.planar.product=[%s]" "$sys_mb_product" 178285732Sallanjude 179285732Sallanjude # 180285732Sallanjude # Laptop Models 181285732Sallanjude # 182285679Sallanjude case "$sys_maker" in 183285679Sallanjude "LENOVO") 184285679Sallanjude case "$sys_version" in 185302320Sallanjude "ThinkPad X220"|"ThinkPad T420"|"ThinkPad T520"|"ThinkPad W520") 186285679Sallanjude dialog_workaround "$msg_lenovo_fix" 187285679Sallanjude retval=$? 188285679Sallanjude f_dprintf "lenovofix_prompt=[%s]" "$retval" 189285679Sallanjude if [ $retval -eq $DIALOG_OK ]; then 190285679Sallanjude export ZFSBOOT_PARTITION_SCHEME="GPT + Lenovo Fix" 191285679Sallanjude export WORKAROUND_LENOVO=1 192285679Sallanjude fi 193285679Sallanjude ;; 194285679Sallanjude esac 195285679Sallanjude ;; 196285679Sallanjude "Dell Inc.") 197285679Sallanjude case "$sys_model" in 198302320Sallanjude "Latitude E6330"|"Latitude E7440"|"Latitude E7240"|"Precision Tower 5810") 199285679Sallanjude dialog_workaround "$msg_gpt_active_fix" 200285679Sallanjude retval=$? 201285679Sallanjude f_dprintf "gpt_active_fix_prompt=[%s]" "$retval" 202285679Sallanjude if [ $retval -eq $DIALOG_OK ]; then 203285679Sallanjude export ZFSBOOT_PARTITION_SCHEME="GPT + Active" 204285679Sallanjude export WORKAROUND_GPTACTIVE=1 205285679Sallanjude fi 206285679Sallanjude ;; 207285679Sallanjude esac 208285679Sallanjude ;; 209287843Sallanjude "Hewlett-Packard") 210287843Sallanjude case "$sys_model" in 211287843Sallanjude "HP ProBook 4330s") 212287843Sallanjude dialog_workaround "$msg_gpt_active_fix" 213287843Sallanjude retval=$? 214287843Sallanjude f_dprintf "gpt_active_fix_prompt=[%s]" "$retval" 215287843Sallanjude if [ $retval -eq $DIALOG_OK ]; then 216287843Sallanjude export ZFSBOOT_PARTITION_SCHEME="GPT + Active" 217287843Sallanjude export WORKAROUND_GPTACTIVE=1 218287843Sallanjude fi 219287843Sallanjude ;; 220287843Sallanjude esac 221287843Sallanjude ;; 222285679Sallanjude esac 223285732Sallanjude # 224285732Sallanjude # Motherboard Models 225285732Sallanjude # 226285732Sallanjude case "$sys_mb_maker" in 227285732Sallanjude "Intel Corporation") 228285732Sallanjude case "$sys_mb_product" in 229287843Sallanjude "DP965LT"|"D510MO") 230285732Sallanjude dialog_workaround "$msg_gpt_active_fix" 231285732Sallanjude retval=$? 232285732Sallanjude f_dprintf "gpt_active_fix_prompt=[%s]" "$retval" 233285732Sallanjude if [ $retval -eq $DIALOG_OK ]; then 234285732Sallanjude export ZFSBOOT_PARTITION_SCHEME="GPT + Active" 235285732Sallanjude export WORKAROUND_GPTACTIVE=1 236285732Sallanjude fi 237285732Sallanjude ;; 238285732Sallanjude esac 239285732Sallanjude ;; 240287843Sallanjude "Acer") 241287843Sallanjude case "$sys_mb_product" in 242287843Sallanjude "Veriton M6630G") 243287843Sallanjude dialog_workaround "$msg_gpt_active_fix" 244287843Sallanjude retval=$? 245287843Sallanjude f_dprintf "gpt_active_fix_prompt=[%s]" "$retval" 246287843Sallanjude if [ $retval -eq $DIALOG_OK ]; then 247287843Sallanjude export ZFSBOOT_PARTITION_SCHEME="GPT + Active" 248287843Sallanjude export WORKAROUND_GPTACTIVE=1 249287843Sallanjude fi 250287843Sallanjude ;; 251287843Sallanjude esac 252287843Sallanjude ;; 253285732Sallanjude esac 254285679Sallanjudefi 255285679Sallanjude 256256343SdteskePMODES="\ 257271553Snwhitehorn\"Auto (UFS)\" \"Guided Disk Setup\" \ 258271553SnwhitehornManual \"Manual Disk Setup (experts)\" \ 259256343SdteskeShell \"Open a shell and partition by hand\"" 260218799Snwhitehorn 261256343SdteskeCURARCH=$( uname -m ) 262256343Sdteskecase $CURARCH in 263256343Sdteske amd64|i386) # Booting ZFS Supported 264271567Snwhitehorn PMODES="$PMODES \"Auto (ZFS)\" \"Guided Root-on-ZFS\"" 265256343Sdteske ;; 266256343Sdteske *) # Booting ZFS Unspported 267256343Sdteske ;; 268256343Sdteskeesac 269256343Sdteske 270256343Sdteskeexec 3>&1 271256343SdteskePARTMODE=`echo $PMODES | xargs dialog --backtitle "FreeBSD Installer" \ 272256343Sdteske --title "Partitioning" \ 273256343Sdteske --menu "How would you like to partition your disk?" \ 274259570Sdteske 0 0 0 2>&1 1>&3` || exit 1 275256343Sdteskeexec 3>&- 276256343Sdteske 277256343Sdteskecase "$PARTMODE" in 278271553Snwhitehorn"Auto (UFS)") # Guided 279269653Sthompsa bsdinstall autopart || error "Partitioning error" 280269653Sthompsa bsdinstall mount || error "Failed to mount filesystem" 281218799Snwhitehorn ;; 282256343Sdteske"Shell") # Shell 283218799Snwhitehorn clear 284218799Snwhitehorn echo "Use this shell to set up partitions for the new system. When finished, mount the system at $BSDINSTALL_CHROOT and place an fstab file for the new system at $PATH_FSTAB. Then type 'exit'. You can also enter the partition editor at any time by entering 'bsdinstall partedit'." 285222425Snwhitehorn sh 2>&1 286218799Snwhitehorn ;; 287256343Sdteske"Manual") # Manual 288257842Sdteske if f_isset debugFile; then 289257842Sdteske # Give partedit the path to our logfile so it can append 290269653Sthompsa BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error "Partitioning error" 291257842Sdteske else 292269653Sthompsa bsdinstall partedit || error "Partitioning error" 293257842Sdteske fi 294269653Sthompsa bsdinstall mount || error "Failed to mount filesystem" 295218799Snwhitehorn ;; 296271553Snwhitehorn"Auto (ZFS)") # ZFS 297269653Sthompsa bsdinstall zfsboot || error "ZFS setup failed" 298269653Sthompsa bsdinstall mount || error "Failed to mount filesystem" 299256343Sdteske ;; 300218799Snwhitehorn*) 301269653Sthompsa error "Unknown partitioning mode" 302218799Snwhitehorn ;; 303218799Snwhitehornesac 304218799Snwhitehorn 305218799Snwhitehornif [ ! -z "$FETCH_DISTRIBUTIONS" ]; then 306218799Snwhitehorn ALL_DISTRIBUTIONS="$DISTRIBUTIONS" 307293223Sgjb WANT_DEBUG= 308218799Snwhitehorn 309218799Snwhitehorn # Download to a directory in the new system as scratch space 310219528Snwhitehorn BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" 311269653Sthompsa mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST" 312218799Snwhitehorn 313218799Snwhitehorn export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS" 314218799Snwhitehorn # Try to use any existing distfiles 315220088Snwhitehorn if [ -d $BSDINSTALL_DISTDIR ]; then 316220080Snwhitehorn DISTDIR_IS_UNIONFS=1 317223897Snwhitehorn mount_nullfs -o union "$BSDINSTALL_FETCHDEST" "$BSDINSTALL_DISTDIR" 318225637Snwhitehorn else 319293223Sgjb export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS" 320218799Snwhitehorn export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" 321218799Snwhitehorn fi 322218799Snwhitehorn 323225637Snwhitehorn export FTP_PASSIVE_MODE=YES 324293223Sgjb # Iterate through the distribution list and set a flag if debugging 325293223Sgjb # distributions have been selected. 326293223Sgjb for _DISTRIBUTION in $DISTRIBUTIONS; do 327293223Sgjb case $_DISTRIBUTION in 328293223Sgjb *-dbg.*) 329293223Sgjb [ -e $BSDINSTALL_DISTDIR/$_DISTRIBUTION ] \ 330293223Sgjb && continue 331293223Sgjb WANT_DEBUG=1 332293223Sgjb DEBUG_LIST="\n$DEBUG_LIST\n$_DISTRIBUTION" 333293223Sgjb ;; 334293223Sgjb *) 335293223Sgjb ;; 336293223Sgjb esac 337293223Sgjb done 338293223Sgjb 339293223Sgjb # Fetch the distributions. 340293223Sgjb bsdinstall distfetch 341293223Sgjb rc=$? 342293223Sgjb 343293223Sgjb if [ $rc -ne 0 ]; then 344293223Sgjb # If unable to fetch the remote distributions, recommend 345293223Sgjb # deselecting the debugging distributions, and retrying the 346293223Sgjb # installation, since failure to fetch *-dbg.txz should not 347293223Sgjb # be considered a fatal installation error. 348293223Sgjb msg="Failed to fetch remote distribution" 349293223Sgjb if [ ! -z "$WANT_DEBUG" ]; then 350293223Sgjb # Trim leading and trailing newlines. 351293223Sgjb DEBUG_LIST="${DEBUG_LIST%%\n}" 352293223Sgjb DEBUG_LIST="${DEBUG_LIST##\n}" 353293223Sgjb msg="$msg\n\nPlease deselect the following distributions" 354293223Sgjb msg="$msg and retry the installation:" 355293223Sgjb msg="$msg\n$DEBUG_LIST" 356293223Sgjb fi 357293223Sgjb error "$msg" 358293223Sgjb fi 359218799Snwhitehorn export DISTRIBUTIONS="$ALL_DISTRIBUTIONS" 360218799Snwhitehornfi 361218799Snwhitehorn 362293223Sgjbif [ ! -z "$LOCAL_DISTRIBUTIONS" ]; then 363293223Sgjb # Download to a directory in the new system as scratch space 364293223Sgjb BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist" 365293223Sgjb mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST" 366293223Sgjb # Try to use any existing distfiles 367293223Sgjb if [ -d $BSDINSTALL_DISTDIR ]; then 368293223Sgjb DISTDIR_IS_UNIONFS=1 369293223Sgjb mount_nullfs -o union "$BSDINSTALL_FETCHDEST" "$BSDINSTALL_DISTDIR" 370293223Sgjb export BSDINSTALL_DISTDIR="$BSDINSTALL_FETCHDEST" 371293223Sgjb fi 372293223Sgjb env DISTRIBUTIONS="$LOCAL_DISTRIBUTIONS" \ 373293223Sgjb BSDINSTALL_DISTSITE="file:///usr/freebsd-dist" \ 374293223Sgjb bsdinstall distfetch || \ 375293223Sgjb error "Failed to fetch distribution from local media" 376293223Sgjbfi 377293223Sgjb 378269653Sthompsabsdinstall checksum || error "Distribution checksum failed" 379269653Sthompsabsdinstall distextract || error "Distribution extract failed" 380269653Sthompsabsdinstall rootpass || error "Could not set root password" 381218799Snwhitehorn 382218799Snwhitehorntrap true SIGINT # This section is optional 383218799Snwhitehornif [ "$NETCONFIG_DONE" != yes ]; then 384218799Snwhitehorn bsdinstall netconfig # Don't check for errors -- the user may cancel 385218799Snwhitehornfi 386218799Snwhitehornbsdinstall time 387218799Snwhitehornbsdinstall services 388218799Snwhitehorn 389218799Snwhitehorndialog --backtitle "FreeBSD Installer" --title "Add User Accounts" --yesno \ 390218799Snwhitehorn "Would you like to add users to the installed system now?" 0 0 && \ 391218799Snwhitehorn bsdinstall adduser 392218799Snwhitehorn 393218799Snwhitehornfinalconfig() { 394218799Snwhitehorn exec 3>&1 395218799Snwhitehorn REVISIT=$(dialog --backtitle "FreeBSD Installer" \ 396218799Snwhitehorn --title "Final Configuration" --no-cancel --menu \ 397228194Snwhitehorn "Setup of your FreeBSD system is nearly complete. You can now modify your configuration choices. After this screen, you will have an opportunity to make more complex changes using a shell." 0 0 0 \ 398226507Skensmith "Exit" "Apply configuration and exit installer" \ 399218799Snwhitehorn "Add User" "Add a user to the system" \ 400218799Snwhitehorn "Root Password" "Change root password" \ 401218799Snwhitehorn "Hostname" "Set system hostname" \ 402218799Snwhitehorn "Network" "Networking configuration" \ 403218799Snwhitehorn "Services" "Set daemons to run on startup" \ 404218799Snwhitehorn "Time Zone" "Set system timezone" \ 405228194Snwhitehorn "Handbook" "Install FreeBSD Handbook (requires network)" 2>&1 1>&3) 406218799Snwhitehorn exec 3>&- 407218799Snwhitehorn 408218799Snwhitehorn case "$REVISIT" in 409218799Snwhitehorn "Add User") 410218799Snwhitehorn bsdinstall adduser 411218799Snwhitehorn finalconfig 412218799Snwhitehorn ;; 413218799Snwhitehorn "Root Password") 414218799Snwhitehorn bsdinstall rootpass 415218799Snwhitehorn finalconfig 416218799Snwhitehorn ;; 417218799Snwhitehorn "Hostname") 418218799Snwhitehorn bsdinstall hostname 419218799Snwhitehorn finalconfig 420218799Snwhitehorn ;; 421218799Snwhitehorn "Network") 422218799Snwhitehorn bsdinstall netconfig 423218799Snwhitehorn finalconfig 424218799Snwhitehorn ;; 425218799Snwhitehorn "Services") 426218799Snwhitehorn bsdinstall services 427218799Snwhitehorn finalconfig 428218799Snwhitehorn ;; 429218799Snwhitehorn "Time Zone") 430218799Snwhitehorn bsdinstall time 431218799Snwhitehorn finalconfig 432218799Snwhitehorn ;; 433223897Snwhitehorn "Handbook") 434223897Snwhitehorn bsdinstall docsinstall 435223897Snwhitehorn finalconfig 436223897Snwhitehorn ;; 437218799Snwhitehorn esac 438218799Snwhitehorn} 439218799Snwhitehorn 440218799Snwhitehorn# Allow user to change his mind 441218799Snwhitehornfinalconfig 442218799Snwhitehorn 443218799Snwhitehorntrap error SIGINT # SIGINT is bad again 444269653Sthompsabsdinstall config || error "Failed to save config" 445218799Snwhitehorn 446218799Snwhitehornif [ ! -z "$BSDINSTALL_FETCHDEST" ]; then 447218799Snwhitehorn [ "$BSDINSTALL_FETCHDEST" != "$BSDINSTALL_DISTDIR" ] && \ 448218799Snwhitehorn umount "$BSDINSTALL_DISTDIR" 449218799Snwhitehorn rm -rf "$BSDINSTALL_FETCHDEST" 450218799Snwhitehornfi 451218799Snwhitehorn 452228194Snwhitehorndialog --backtitle "FreeBSD Installer" --title "Manual Configuration" \ 453271552Snwhitehorn --default-button no --yesno \ 454271552Snwhitehorn "The installation is now finished. Before exiting the installer, would you like to open a shell in the new system to make any final manual modifications?" 0 0 455228194Snwhitehornif [ $? -eq 0 ]; then 456228194Snwhitehorn clear 457232531Snwhitehorn mount -t devfs devfs "$BSDINSTALL_CHROOT/dev" 458228194Snwhitehorn echo This shell is operating in a chroot in the new system. \ 459228194Snwhitehorn When finished making configuration changes, type \"exit\". 460228194Snwhitehorn chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1 461228194Snwhitehornfi 462228194Snwhitehorn 463256338Sdesbsdinstall entropy 464256338Sdesbsdinstall umount 465256338Sdes 466257842Sdteskef_dprintf "Installation Completed at %s" "$( date )" 467218799Snwhitehorn 468257842Sdteske################################################################################ 469257842Sdteske# END 470257842Sdteske################################################################################ 471