diff options
author | Robert Peichaer <rpe@cvs.openbsd.org> | 2015-05-31 19:40:12 +0000 |
---|---|---|
committer | Robert Peichaer <rpe@cvs.openbsd.org> | 2015-05-31 19:40:12 +0000 |
commit | 6f39b0ff9a313e2af7b93085787d409c1c1453e3 (patch) | |
tree | 3f7fde2797aade6486218968d307eaadf174251f /distrib/miniroot/install.sub | |
parent | ee8cc5a387b2b975f8d2ebd7d500640ba40558c7 (diff) |
Replace identical code in the MD scripts of the installer with a new
MI function disklabel_autolayout() which now handles all aspects of
the disklabel auto-layout and autopartitioning case for the root disk.
Remove get_disklabel_template() and merge it with the new function.
"move forward" deraadt@
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r-- | distrib/miniroot/install.sub | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index e4c7c26b885..1a24a021498 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.841 2015/05/20 19:14:35 rpe Exp $ +# $OpenBSD: install.sub,v 1.842 2015/05/31 19:40:10 rpe Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -268,6 +268,49 @@ getdevname() { fi } +# Handle disklabel auto-layout during interactive installation and +# autopartitioning during unattended installation for the root disk. +# In the latter case, ask for and download autopartitioning template. +# Abort unattended installation if autopartitioning fails. +# +# Parameters: +# +# $1 = disk +# $2 = /path/to/fstab +# +disklabel_autolayout() { + local _disk=$1 _f=$2 _dl=/disklabel.auto _op + + [[ $_disk != $ROOTDISK ]] && return + + while $AUTO; do + ask "URL to autopartitioning template for disklabel?" none + [[ $resp == none ]] && break + echo "Fetching $resp" + if ftp -Vo $_dl "$resp" && [[ -s $_dl ]]; then + disklabel -T $_dl $FSTABFLAG $_f -w -A $_disk && return + echo "Autopartitioning failed" + exit 1 + else + echo "No autopartitioning template found." + exit 1 + fi + done + + while :; do + echo "The auto-allocated layout for $_disk is:" + disklabel -h -A $_disk | egrep "^# |^ [a-p]:" + ask "Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout?" a + case $resp in + a*|A*) _op=-w ;; + e*|E*) _op=-E ;; + c*|C*) return 0 ;; + *) continue ;; + esac + disklabel $FSTABFLAG $_f $_op -A $_disk + return + done +} #------------------------------------------------------------------------------- # Functions for the dmesg listener @@ -1661,18 +1704,6 @@ get_rootinfo() { SWAPDEV=${ROOTDISK}b } -# Ask for and download autopartitioning template for disklabel. -get_disklabel_template() { - local _dl=/disklabel.auto - - ask "URL to autopartitioning template for disklabel?" none - [[ $resp == none ]] && return 1 - echo "Fetching $resp" - ftp -Vo $_dl "$resp" && [[ -s $_dl ]] && return - echo "No autopartitioning template found." - exit 1 -} - # Start interface using the on-disk hostname.if file passed as argument $1. # Much of this is gratuitously stolen from /etc/netstart. ifstart () { |