summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall/scripts
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
committersjg <sjg@FreeBSD.org>2014-11-19 01:07:58 +0000
commitb137080f19736ee33fede2e88bb54438604cf86b (patch)
tree377ac0ac449528621eb192cd245adadb5fd53668 /usr.sbin/bsdinstall/scripts
parentab21a29eb607d4dfe389b965fbdee27558e791aa (diff)
parent4a8d07956d121238d006d34ffe7d6269744e8b1a (diff)
downloadFreeBSD-src-b137080f19736ee33fede2e88bb54438604cf86b.zip
FreeBSD-src-b137080f19736ee33fede2e88bb54438604cf86b.tar.gz
Merge from head@274682
Diffstat (limited to 'usr.sbin/bsdinstall/scripts')
-rwxr-xr-xusr.sbin/bsdinstall/scripts/auto51
-rwxr-xr-xusr.sbin/bsdinstall/scripts/config1
-rwxr-xr-xusr.sbin/bsdinstall/scripts/jail24
-rwxr-xr-xusr.sbin/bsdinstall/scripts/services1
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot62
5 files changed, 103 insertions, 36 deletions
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
index c2d8fc0..433744e 100755
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -35,11 +35,15 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
############################################################ FUNCTIONS
error() {
+ local msg
+ if [ -n "$1" ]; then
+ msg="$1\n\n"
+ fi
test -n "$DISTDIR_IS_UNIONFS" && umount -f $BSDINSTALL_DISTDIR
test -f $PATH_FSTAB && bsdinstall umount
dialog --backtitle "FreeBSD Installer" --title "Abort" \
--no-label "Exit" --yes-label "Restart" --yesno \
- "An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
+ "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
if [ $? -ne 0 ]; then
exit 1
else
@@ -58,7 +62,7 @@ trap true SIGINT # This section is optional
bsdinstall keymap
trap error SIGINT # Catch cntrl-C here
-bsdinstall hostname || error
+bsdinstall hostname || error "Set hostname failed"
export DISTRIBUTIONS="base.txz kernel.txz"
if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
@@ -95,7 +99,7 @@ if [ -n "$FETCH_DISTRIBUTIONS" ]; then
BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3)
MIRROR_BUTTON=$?
exec 3>&-
- test $MIRROR_BUTTON -eq 0 || error
+ test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
export BSDINSTALL_DISTSITE
fi
@@ -103,14 +107,14 @@ rm -f $PATH_FSTAB
touch $PATH_FSTAB
PMODES="\
-Guided \"Partitioning Tool (Recommended for Beginners)\" \
-Manual \"Manually Configure Partitions (Expert)\" \
+\"Auto (UFS)\" \"Guided Disk Setup\" \
+Manual \"Manual Disk Setup (experts)\" \
Shell \"Open a shell and partition by hand\""
CURARCH=$( uname -m )
case $CURARCH in
amd64|i386) # Booting ZFS Supported
- PMODES="$PMODES ZFS \"Automatic Root-on-ZFS (Experimental)\""
+ PMODES="$PMODES \"Auto (ZFS)\" \"Guided Root-on-ZFS\""
;;
*) # Booting ZFS Unspported
;;
@@ -124,9 +128,9 @@ PARTMODE=`echo $PMODES | xargs dialog --backtitle "FreeBSD Installer" \
exec 3>&-
case "$PARTMODE" in
-"Guided") # Guided
- bsdinstall autopart || error
- bsdinstall mount || error
+"Auto (UFS)") # Guided
+ bsdinstall autopart || error "Partitioning error"
+ bsdinstall mount || error "Failed to mount filesystem"
;;
"Shell") # Shell
clear
@@ -136,18 +140,18 @@ case "$PARTMODE" in
"Manual") # Manual
if f_isset debugFile; then
# Give partedit the path to our logfile so it can append
- BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error
+ BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error "Partitioning error"
else
- bsdinstall partedit || error
+ bsdinstall partedit || error "Partitioning error"
fi
- bsdinstall mount || error
+ bsdinstall mount || error "Failed to mount filesystem"
;;
-"ZFS") # ZFS
- bsdinstall zfsboot || error
- bsdinstall mount || error
+"Auto (ZFS)") # ZFS
+ bsdinstall zfsboot || error "ZFS setup failed"
+ bsdinstall mount || error "Failed to mount filesystem"
;;
*)
- error
+ error "Unknown partitioning mode"
;;
esac
@@ -156,7 +160,7 @@ if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
# Download to a directory in the new system as scratch space
BSDINSTALL_FETCHDEST="$BSDINSTALL_CHROOT/usr/freebsd-dist"
- mkdir -p "$BSDINSTALL_FETCHDEST" || error
+ mkdir -p "$BSDINSTALL_FETCHDEST" || error "Could not create directory $BSDINSTALL_FETCHDEST"
export DISTRIBUTIONS="$FETCH_DISTRIBUTIONS"
# Try to use any existing distfiles
@@ -169,13 +173,13 @@ if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
fi
export FTP_PASSIVE_MODE=YES
- bsdinstall distfetch || error
+ bsdinstall distfetch || error "Failed to fetch distribution"
export DISTRIBUTIONS="$ALL_DISTRIBUTIONS"
fi
-bsdinstall checksum || error
-bsdinstall distextract || error
-bsdinstall rootpass || error
+bsdinstall checksum || error "Distribution checksum failed"
+bsdinstall distextract || error "Distribution extract failed"
+bsdinstall rootpass || error "Could not set root password"
trap true SIGINT # This section is optional
if [ "$NETCONFIG_DONE" != yes ]; then
@@ -239,7 +243,7 @@ finalconfig() {
finalconfig
trap error SIGINT # SIGINT is bad again
-bsdinstall config || error
+bsdinstall config || error "Failed to save config"
if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then
[ "$BSDINSTALL_FETCHDEST" != "$BSDINSTALL_DISTDIR" ] && \
@@ -248,7 +252,8 @@ if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then
fi
dialog --backtitle "FreeBSD Installer" --title "Manual Configuration" \
- --yesno "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
+ --default-button no --yesno \
+ "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
if [ $? -eq 0 ]; then
clear
mount -t devfs devfs "$BSDINSTALL_CHROOT/dev"
diff --git a/usr.sbin/bsdinstall/scripts/config b/usr.sbin/bsdinstall/scripts/config
index 98baade..bc3d723 100755
--- a/usr.sbin/bsdinstall/scripts/config
+++ b/usr.sbin/bsdinstall/scripts/config
@@ -36,6 +36,7 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc
cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf
rm $BSDINSTALL_TMPBOOT/loader.conf.*
+df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf
cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot
diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail
index e709145..cb86060 100755
--- a/usr.sbin/bsdinstall/scripts/jail
+++ b/usr.sbin/bsdinstall/scripts/jail
@@ -38,9 +38,13 @@ f_dprintf "Began Installation at %s" "$( date )"
export BSDINSTALL_CHROOT=$1
error() {
+ local msg
+ if [ -n "$1" ]; then
+ msg="$1\n\n"
+ fi
dialog --backtitle "FreeBSD Installer" --title "Abort" \
--no-label "Exit" --yes-label "Restart" --yesno \
- "An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
+ "${msg}An installation step has been aborted. Would you like to restart the installation or exit the installer?" 0 0
if [ $? -ne 0 ]; then
exit
else
@@ -51,7 +55,7 @@ error() {
rm -rf $BSDINSTALL_TMPETC
mkdir $BSDINSTALL_TMPETC
-mkdir -p $1 || error
+mkdir -p $1 || error "mkdir failed for $1"
test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
@@ -60,9 +64,9 @@ if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -a -z "$BSDINSTALL_DISTSITE" ]; then
BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&3)
MIRROR_BUTTON=$?
exec 3>&-
- test $MIRROR_BUTTON -eq 0 || error
+ test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
export BSDINSTALL_DISTSITE
- fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error
+ fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error "Could not download $BSDINSTALL_DISTSITE/MANIFEST"
fi
export DISTRIBUTIONS="base.txz"
@@ -94,17 +98,17 @@ if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
BSDINSTALL_DISTSITE=`bsdinstall mirrorselect 2>&1 1>&3`
MIRROR_BUTTON=$?
exec 3>&-
- test $MIRROR_BUTTON -eq 0 || error
+ test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
export BSDINSTALL_DISTSITE
fi
if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
- bsdinstall distfetch || error
+ bsdinstall distfetch || error "Failed to fetch distribution"
fi
-bsdinstall checksum || error
-bsdinstall distextract || error
-bsdinstall rootpass || error
+bsdinstall checksum || error "Distribution checksum failed"
+bsdinstall distextract || error "Distribution extract failed"
+bsdinstall rootpass || error "Could not set root password"
trap true SIGINT # This section is optional
bsdinstall services
@@ -114,7 +118,7 @@ dialog --backtitle "FreeBSD Installer" --title "Add User Accounts" --yesno \
bsdinstall adduser
trap error SIGINT # SIGINT is bad again
-bsdinstall config || error
+bsdinstall config || error "Failed to save config"
cp /etc/resolv.conf $1/etc
cp /etc/localtime $1/etc
diff --git a/usr.sbin/bsdinstall/scripts/services b/usr.sbin/bsdinstall/scripts/services
index 54c5018..83786c2 100755
--- a/usr.sbin/bsdinstall/scripts/services
+++ b/usr.sbin/bsdinstall/scripts/services
@@ -43,6 +43,7 @@ DAEMONS=$( dialog --backtitle "FreeBSD Installer" \
--title "System Configuration" --nocancel --separate-output \
--checklist "Choose the services you would like to be started at boot:" \
0 0 0 \
+ local_unbound "Local caching validating resolver" ${local_unbound:-off} \
sshd "Secure shell daemon" ${sshd_enable:-off} \
moused "PS/2 mouse pointer on console" ${moused_enable:-off} \
ntpd "Synchronize system and network time" ${ntpd_enable:-off} \
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index 9f1abb8..2b01dea 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -156,7 +156,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATASETS="
/usr/src
# Create /var and friends
- /var mountpoint=/var
+ /var mountpoint=/var,canmount=off
/var/crash exec=off,setuid=off
/var/log exec=off,setuid=off
/var/mail atime=on
@@ -293,6 +293,7 @@ msg_swap_mirror_help="Mirror swap partitions for redundancy, breaks crash dumps"
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(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_uefi_not_supported="The FreeBSD UEFI loader does not currently support booting root-on-ZFS. Your system will need to boot in legacy (CSM) mode.\nDo you want to continue?"
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."
@@ -687,6 +688,48 @@ dialog_menu_layout()
return $DIALOG_OK
}
+# dialog_uefi_prompt
+#
+# Confirm that the user wants to continue with the installation on a BIOS
+# system when they have booted with UEFI
+#
+dialog_uefi_prompt()
+{
+ local title="$DIALOG_TITLE"
+ local btitle="$DIALOG_BACKTITLE"
+ local prompt # Calculated below
+ local hline="$hline_arrows_tab_enter"
+
+ local height=8 width=50 prefix=" "
+ local plen=${#prefix} list= line=
+ local max_width=$(( $width - 3 - $plen ))
+
+ local yes no defaultno extra_args format
+ if [ "$USE_XDIALOG" ]; then
+ yes=ok no=cancel defaultno=default-no
+ extra_args="--wrap --left"
+ format="$msg_uefi_not_supported"
+ else
+ yes=yes no=no defaultno=defaultno
+ extra_args="--cr-wrap"
+ format="$msg_uefi_not_supported"
+ fi
+
+ # Add height for Xdialog(1)
+ [ "$USE_XDIALOG" ] && height=$(( $height + $height / 5 + 3 ))
+
+ prompt=$( printf "$format" )
+ f_dprintf "%s: UEFI prompt" "$0"
+ $DIALOG \
+ --title "$title" \
+ --backtitle "$btitle" \
+ --hline "$hline" \
+ --$yes-label "$msg_yes" \
+ --$no-label "$msg_no" \
+ $extra_args \
+ --yesno "$prompt" $height $width
+}
+
# zfs_create_diskpart $disk $index
#
# For each block device to be used in the zpool, rather than just create the
@@ -1272,8 +1315,6 @@ zfs_create_boot()
"$funcname"
f_eval_catch $funcname echo "$ECHO_APPEND" 'zfs_enable=\"YES\"' \
$BSDINSTALL_TMPETC/rc.conf.zfs || return $FAILURE
- f_eval_catch $funcname echo "$ECHO_APPEND" 'zfs_load=\"YES\"' \
- $BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE
f_eval_catch $funcname echo "$ECHO_APPEND" \
'kern.geom.label.disk_ident.enable=\"0\"' \
$BSDINSTALL_TMPBOOT/loader.conf.zfs || return $FAILURE
@@ -1386,6 +1427,21 @@ f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSDINSTALL_TMPETC"
f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT"
#
+# If the system was booted with UEFI, warn the user that FreeBSD can't do
+# ZFS with UEFI yet
+#
+if f_interactive; then
+ bootmethod=$(sysctl -n machdep.bootmethod)
+ f_dprintf "machdep.bootmethod=[%s]" "$bootmethod"
+ if [ "$bootmethod" != "BIOS" ]; then
+ dialog_uefi_prompt
+ retval=$?
+ f_dprintf "uefi_prompt=[%s]" "$retval"
+ [ $retval -eq $DIALOG_OK ] || f_die
+ fi
+fi
+
+#
# Loop over the main menu until we've accomplished what we came here to do
#
while :; do
OpenPOWER on IntegriCloud