Permalink
Browse files

Add zfsboot module as an option for automatic configuration. Default is

to run interactively but it can be scripted too (optinally completely
non-interactive). Currently supports GELI and all ZFS vdev types. Also
performs validation on selections/settings providing error messages if
necessary, explaining (in plain language) what the issue is. Currently
the auto partitioning of naked disks only supports GPT and MBR (VTOC8
pending for sparc64), so is only available for i386/amd64 install.

Submitted by:	Allan Jude <freebsd@allanjude.com>, myself
Reviewed by:	Allan Jude <freebsd@allanjude.com>
Approved by:	re (glebius)
  • Loading branch information...
devinteske committed Oct 11, 2013
1 parent c0413eb commit 4ff80fc958fa143107ee77b1b5e699102342cdf1
@@ -28,12 +28,14 @@

: ${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

[ -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"
@@ -2,7 +2,7 @@

SCRIPTS= auto adduser checksum config docsinstall entropy hostname jail \
keymap mirrorselect mount netconfig netconfig_ipv4 netconfig_ipv6 \
rootpass script services time umount wlanconfig
rootpass script services time umount wlanconfig zfsboot
BINDIR= /usr/libexec/bsdinstall

NO_MAN= true
@@ -93,24 +93,46 @@ fi
rm $PATH_FSTAB
touch $PATH_FSTAB

dialog --backtitle "FreeBSD Installer" --title "Partitioning" --extra-button \
--extra-label "Manual" --ok-label "Guided" --cancel-label "Shell" \
--yesno "Would you like to use the guided partitioning tool (recommended for beginners) or to set up partitions manually (experts)? You can also open a shell and set up partitions entirely by hand." 0 0
PMODES="\
Guided \"Partitioning Tool (Recommended for Beginners)\" \
Manual \"Manually Configure Partitions (Expert)\" \
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)\""
;;
*) # Booting ZFS Unspported
;;
esac

case $? in
0) # Guided
exec 3>&1
PARTMODE=`echo $PMODES | xargs dialog --backtitle "FreeBSD Installer" \
--title "Partitioning" \
--menu "How would you like to partition your disk?" \
0 0 0 2>&1 1>&3`
if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi
exec 3>&-

case "$PARTMODE" in
"Guided") # Guided
bsdinstall autopart || error
bsdinstall mount || error
;;
1) # Shell
"Shell") # Shell
clear
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'."
sh 2>&1
;;
3) # Manual
"Manual") # Manual
bsdinstall partedit || error
bsdinstall mount || error
;;
"ZFS") # ZFS
bsdinstall zfsboot || error
bsdinstall mount || error
;;
*)
error
;;
@@ -31,6 +31,11 @@ rm $BSDINSTALL_TMPETC/rc.conf.*

cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc

cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf
rm $BSDINSTALL_TMPBOOT/loader.conf.*

cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot

# Set up other things from installed config
chroot $BSDINSTALL_CHROOT /usr/bin/newaliases

Oops, something went wrong.

0 comments on commit 4ff80fc

Please sign in to comment.