From 6b7e7e25ab87ee2143e83fdc787d57f1ba487289 Mon Sep 17 00:00:00 2001 From: rpe Date: Sun, 31 May 2015 19:40:10 +0000 Subject: [PATCH] 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@ --- distrib/alpha/common/install.md | 28 +++----------- distrib/amd64/common/install.md | 27 ++------------ distrib/armish/ramdisk/install.md | 27 ++------------ distrib/armv7/ramdisk/install.md | 27 ++------------ distrib/aviion/ramdisk/install.md | 30 ++++----------- distrib/hppa/install.md | 28 +++----------- distrib/i386/common/install.md | 27 ++------------ distrib/landisk/ramdisk/install.md | 27 ++------------ distrib/loongson/ramdisk/install.md | 27 ++------------ distrib/luna88k/ramdisk/install.md | 28 +++----------- distrib/macppc/ramdisk/install.md | 27 ++------------ distrib/miniroot/install.sub | 57 ++++++++++++++++++++++------- distrib/octeon/ramdisk/install.md | 27 ++------------ distrib/sgi/ramdisk/install.md | 27 ++------------ distrib/socppc/ramdisk/install.md | 27 ++------------ distrib/sparc/install.md | 28 +++----------- distrib/sparc64/common/install.md | 28 +++----------- distrib/vax/install.md | 28 +++----------- distrib/zaurus/ramdisk/install.md | 27 ++------------ 19 files changed, 125 insertions(+), 427 deletions(-) diff --git a/distrib/alpha/common/install.md b/distrib/alpha/common/install.md index 6431d48b00f..d2874d77fca 100644 --- a/distrib/alpha/common/install.md +++ b/distrib/alpha/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.39 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.40 2015/05/31 19:40:10 rpe Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -43,29 +43,11 @@ md_installboot() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 + + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi cat <<__EOT You will now create a OpenBSD disklabel on the disk. The disklabel defines how OpenBSD splits up the disk into OpenBSD partitions in which filesystems diff --git a/distrib/amd64/common/install.md b/distrib/amd64/common/install.md index 0f9d883a2a3..c8a8738b9c3 100644 --- a/distrib/amd64/common/install.md +++ b/distrib/amd64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.38 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.39 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -92,31 +92,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/armish/ramdisk/install.md b/distrib/armish/ramdisk/install.md index 803f654fb7a..98c40d9eb6d 100644 --- a/distrib/armish/ramdisk/install.md +++ b/distrib/armish/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.17 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.18 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -81,31 +81,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/armv7/ramdisk/install.md b/distrib/armv7/ramdisk/install.md index c1e546ff931..2162348696c 100644 --- a/distrib/armv7/ramdisk/install.md +++ b/distrib/armv7/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.8 2015/05/20 01:44:20 jsg Exp $ +# $OpenBSD: install.md,v 1.9 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -172,31 +172,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/aviion/ramdisk/install.md b/distrib/aviion/ramdisk/install.md index 7e27e00c65c..73cf016b4f2 100644 --- a/distrib/aviion/ramdisk/install.md +++ b/distrib/aviion/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.6 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.7 2015/05/31 19:40:10 rpe Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -75,7 +75,7 @@ md_has_ldm () { } md_prep_disklabel() { - local _disk=$1 _f _op _shared=n + local _disk=$1 _f=/tmp/fstab.$1 _shared=n if md_has_boot_area $_disk; then if md_has_ldm $_disk; then @@ -112,28 +112,12 @@ __EOT fi fi - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - _mdnoautoinstallboot=$_shared - return - done + disklabel_autolayout $_disk $_f || return + if [[ -s $_f ]]; then + _mdnoautoinstallboot=$_shared + return fi + cat <<__EOT You will now create a OpenBSD disklabel on the disk. The disklabel defines how OpenBSD splits up the disk into OpenBSD partitions in which filesystems diff --git a/distrib/hppa/install.md b/distrib/hppa/install.md index 2e78018a008..96b5577caf7 100644 --- a/distrib/hppa/install.md +++ b/distrib/hppa/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.28 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.29 2015/05/31 19:40:10 rpe Exp $ # # machine dependent section of installation/upgrade script. # @@ -17,31 +17,13 @@ md_installboot() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 installboot $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return + cat <<__EOT You will now create a OpenBSD disklabel on the disk. The disklabel defines how OpenBSD splits up the disk into OpenBSD partitions in which filesystems diff --git a/distrib/i386/common/install.md b/distrib/i386/common/install.md index 05c19423586..f318e899d5e 100644 --- a/distrib/i386/common/install.md +++ b/distrib/i386/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.61 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.62 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -92,31 +92,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/landisk/ramdisk/install.md b/distrib/landisk/ramdisk/install.md index 3d3b07b42dd..12fbb2f0b4e 100644 --- a/distrib/landisk/ramdisk/install.md +++ b/distrib/landisk/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.31 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.32 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -85,31 +85,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/loongson/ramdisk/install.md b/distrib/loongson/ramdisk/install.md index 8989819848a..0f993a1df34 100644 --- a/distrib/loongson/ramdisk/install.md +++ b/distrib/loongson/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.17 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.18 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -127,31 +127,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/luna88k/ramdisk/install.md b/distrib/luna88k/ramdisk/install.md index 1d21db7f9e9..55738a40ec1 100644 --- a/distrib/luna88k/ramdisk/install.md +++ b/distrib/luna88k/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.19 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.20 2015/05/31 19:40:10 rpe Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -42,29 +42,11 @@ md_installboot() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 + + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi cat <<__EOT You will now create a OpenBSD disklabel on the disk. The disklabel defines how OpenBSD splits up the disk into OpenBSD partitions in which filesystems diff --git a/distrib/macppc/ramdisk/install.md b/distrib/macppc/ramdisk/install.md index f0a5da78fd2..128591e4b35 100644 --- a/distrib/macppc/ramdisk/install.md +++ b/distrib/macppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.57 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.58 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -153,7 +153,7 @@ md_prep_HFS() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 PARTTABLE= while [[ -z $PARTTABLE ]]; do @@ -171,27 +171,8 @@ md_prep_disklabel() { esac done - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT 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 @@ -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 () { diff --git a/distrib/octeon/ramdisk/install.md b/distrib/octeon/ramdisk/install.md index f2266a9d0bb..01739ba2d41 100644 --- a/distrib/octeon/ramdisk/install.md +++ b/distrib/octeon/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.7 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.8 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -109,31 +109,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/sgi/ramdisk/install.md b/distrib/sgi/ramdisk/install.md index 1ae0876a399..7c5ef2e74a2 100644 --- a/distrib/sgi/ramdisk/install.md +++ b/distrib/sgi/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.34 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.35 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ md_installboot() { md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 echo echo "Checking SGI Volume Header:" @@ -143,27 +143,8 @@ __EOT ;; esac - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/socppc/ramdisk/install.md b/distrib/socppc/ramdisk/install.md index e6bddb4e0ad..14474fe0ab5 100644 --- a/distrib/socppc/ramdisk/install.md +++ b/distrib/socppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.19 2015/05/04 19:55:26 rpe Exp $ +# $OpenBSD: install.md,v 1.20 2015/05/31 19:40:10 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -89,31 +89,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT diff --git a/distrib/sparc/install.md b/distrib/sparc/install.md index 3debe2fc025..392fc8e1799 100644 --- a/distrib/sparc/install.md +++ b/distrib/sparc/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.71 2015/05/04 19:55:27 rpe Exp $ +# $OpenBSD: install.md,v 1.72 2015/05/31 19:40:10 rpe Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -45,29 +45,11 @@ md_installboot() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 + + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi cat <<__EOT You will now create a Sun-style disklabel on the disk. The disklabel defines diff --git a/distrib/sparc64/common/install.md b/distrib/sparc64/common/install.md index cdf32b97cf8..fc2a875f0d4 100644 --- a/distrib/sparc64/common/install.md +++ b/distrib/sparc64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.43 2015/05/04 19:55:27 rpe Exp $ +# $OpenBSD: install.md,v 1.44 2015/05/31 19:40:11 rpe Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -49,29 +49,11 @@ md_installboot() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 + + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi cat <<__EOT You will now create a Sun-style disklabel on the disk. The disklabel defines diff --git a/distrib/vax/install.md b/distrib/vax/install.md index dfcdb707620..93c4b3e99d4 100644 --- a/distrib/vax/install.md +++ b/distrib/vax/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.43 2015/05/04 19:55:27 rpe Exp $ +# $OpenBSD: install.md,v 1.44 2015/05/31 19:40:11 rpe Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -45,29 +45,11 @@ md_installboot() { } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 + + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi cat <<__EOT You will now create a OpenBSD disklabel on the disk. The disklabel defines how OpenBSD splits up the disk into OpenBSD partitions in which filesystems diff --git a/distrib/zaurus/ramdisk/install.md b/distrib/zaurus/ramdisk/install.md index ff00c3b1854..52782a36eae 100644 --- a/distrib/zaurus/ramdisk/install.md +++ b/distrib/zaurus/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.32 2015/05/04 19:55:27 rpe Exp $ +# $OpenBSD: install.md,v 1.33 2015/05/31 19:40:11 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -83,31 +83,12 @@ __EOT } md_prep_disklabel() { - local _disk=$1 _f _op + local _disk=$1 _f=/tmp/fstab.$1 md_prep_fdisk $_disk - _f=/tmp/fstab.$_disk - if [[ $_disk == $ROOTDISK ]]; then - if $AUTO && get_disklabel_template; then - disklabel -T /disklabel.auto $FSTABFLAG $_f -w -A $_disk && return - echo "Autopartitioning failed" - exit 1 - fi - 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*) break ;; - *) continue ;; - esac - disklabel $FSTABFLAG $_f $_op -A $_disk - return - done - fi + disklabel_autolayout $_disk $_f || return + [[ -s $_f ]] && return cat <<__EOT -- 2.20.1