From 12cba9fa7b097200b96c5b720c69521ecad03052 Mon Sep 17 00:00:00 2001 From: rpe Date: Mon, 4 May 2015 19:55:26 +0000 Subject: [PATCH] Add the new template file based autopartitioning feature of disklabel(8) to the OpenBSD installer. It is available during unattended installation. The template file is fetched from an url, provided as answer to a new question in the response file: URL to autopartitioning template for disklabel = url Original diff from and OK henning@ 'no objection' krw@ --- distrib/alpha/common/install.md | 7 ++++++- distrib/amd64/common/install.md | 7 ++++++- distrib/armish/ramdisk/install.md | 7 ++++++- distrib/armv7/ramdisk/install.md | 7 ++++++- distrib/aviion/ramdisk/install.md | 7 ++++++- distrib/hppa/install.md | 7 ++++++- distrib/i386/common/install.md | 7 ++++++- distrib/landisk/ramdisk/install.md | 7 ++++++- distrib/loongson/ramdisk/install.md | 7 ++++++- distrib/luna88k/ramdisk/install.md | 7 ++++++- distrib/macppc/ramdisk/install.md | 7 ++++++- distrib/miniroot/install.sub | 14 +++++++++++++- distrib/octeon/ramdisk/install.md | 7 ++++++- distrib/sgi/ramdisk/install.md | 7 ++++++- distrib/socppc/ramdisk/install.md | 7 ++++++- distrib/sparc/install.md | 7 ++++++- distrib/sparc64/common/install.md | 7 ++++++- distrib/vax/install.md | 7 ++++++- distrib/zaurus/ramdisk/install.md | 7 ++++++- 19 files changed, 121 insertions(+), 19 deletions(-) diff --git a/distrib/alpha/common/install.md b/distrib/alpha/common/install.md index 339c3c35848..6431d48b00f 100644 --- a/distrib/alpha/common/install.md +++ b/distrib/alpha/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.38 2014/08/15 09:45:54 rpe Exp $ +# $OpenBSD: install.md,v 1.39 2015/05/04 19:55:26 rpe Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -47,6 +47,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/amd64/common/install.md b/distrib/amd64/common/install.md index 830f5dc8a94..0f9d883a2a3 100644 --- a/distrib/amd64/common/install.md +++ b/distrib/amd64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.37 2015/01/12 16:33:31 deraadt Exp $ +# $OpenBSD: install.md,v 1.38 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -98,6 +98,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/armish/ramdisk/install.md b/distrib/armish/ramdisk/install.md index 5e270423bfe..803f654fb7a 100644 --- a/distrib/armish/ramdisk/install.md +++ b/distrib/armish/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.16 2013/11/16 18:37:26 rpe Exp $ +# $OpenBSD: install.md,v 1.17 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -87,6 +87,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/armv7/ramdisk/install.md b/distrib/armv7/ramdisk/install.md index dfc893bd6db..35771ab2757 100644 --- a/distrib/armv7/ramdisk/install.md +++ b/distrib/armv7/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.6 2015/01/26 01:55:55 jsg Exp $ +# $OpenBSD: install.md,v 1.7 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -190,6 +190,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/aviion/ramdisk/install.md b/distrib/aviion/ramdisk/install.md index f2e812d5a69..7e27e00c65c 100644 --- a/distrib/aviion/ramdisk/install.md +++ b/distrib/aviion/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.5 2014/08/15 09:45:54 rpe Exp $ +# $OpenBSD: install.md,v 1.6 2015/05/04 19:55:26 rpe Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -114,6 +114,11 @@ __EOT _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]:" diff --git a/distrib/hppa/install.md b/distrib/hppa/install.md index 9041c745a71..2e78018a008 100644 --- a/distrib/hppa/install.md +++ b/distrib/hppa/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.27 2015/03/08 13:13:48 deraadt Exp $ +# $OpenBSD: install.md,v 1.28 2015/05/04 19:55:26 rpe Exp $ # # machine dependent section of installation/upgrade script. # @@ -23,6 +23,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/i386/common/install.md b/distrib/i386/common/install.md index f6599eeac7b..05c19423586 100644 --- a/distrib/i386/common/install.md +++ b/distrib/i386/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.60 2015/01/12 16:33:31 deraadt Exp $ +# $OpenBSD: install.md,v 1.61 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -98,6 +98,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/landisk/ramdisk/install.md b/distrib/landisk/ramdisk/install.md index 2b523c0a0c3..3d3b07b42dd 100644 --- a/distrib/landisk/ramdisk/install.md +++ b/distrib/landisk/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.30 2013/11/16 18:37:27 rpe Exp $ +# $OpenBSD: install.md,v 1.31 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -91,6 +91,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/loongson/ramdisk/install.md b/distrib/loongson/ramdisk/install.md index 83d4d8546ff..8989819848a 100644 --- a/distrib/loongson/ramdisk/install.md +++ b/distrib/loongson/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.16 2015/04/19 00:37:36 deraadt Exp $ +# $OpenBSD: install.md,v 1.17 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -133,6 +133,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/luna88k/ramdisk/install.md b/distrib/luna88k/ramdisk/install.md index 385be398cb8..1d21db7f9e9 100644 --- a/distrib/luna88k/ramdisk/install.md +++ b/distrib/luna88k/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.18 2014/08/15 09:45:54 rpe Exp $ +# $OpenBSD: install.md,v 1.19 2015/05/04 19:55:26 rpe Exp $ # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. # @@ -46,6 +46,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/macppc/ramdisk/install.md b/distrib/macppc/ramdisk/install.md index 32a108690ae..f0a5da78fd2 100644 --- a/distrib/macppc/ramdisk/install.md +++ b/distrib/macppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.56 2014/08/20 06:52:21 phessler Exp $ +# $OpenBSD: install.md,v 1.57 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -173,6 +173,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index c77003ccdbe..2d14bbdcfa2 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.835 2015/04/28 21:41:40 sthen Exp $ +# $OpenBSD: install.sub,v 1.836 2015/05/04 19:55:26 rpe Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -1671,6 +1671,18 @@ 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 e987ff22558..f2266a9d0bb 100644 --- a/distrib/octeon/ramdisk/install.md +++ b/distrib/octeon/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.6 2014/03/05 20:03:01 jasper Exp $ +# $OpenBSD: install.md,v 1.7 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -115,6 +115,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/sgi/ramdisk/install.md b/distrib/sgi/ramdisk/install.md index e374abc36c9..1ae0876a399 100644 --- a/distrib/sgi/ramdisk/install.md +++ b/distrib/sgi/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.33 2014/03/24 20:47:30 miod Exp $ +# $OpenBSD: install.md,v 1.34 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -145,6 +145,11 @@ __EOT _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]:" diff --git a/distrib/socppc/ramdisk/install.md b/distrib/socppc/ramdisk/install.md index a28c1a85393..e6bddb4e0ad 100644 --- a/distrib/socppc/ramdisk/install.md +++ b/distrib/socppc/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.18 2013/11/16 18:37:27 rpe Exp $ +# $OpenBSD: install.md,v 1.19 2015/05/04 19:55:26 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -95,6 +95,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/sparc/install.md b/distrib/sparc/install.md index 0b4d0234946..3debe2fc025 100644 --- a/distrib/sparc/install.md +++ b/distrib/sparc/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.70 2015/03/11 15:21:50 deraadt Exp $ +# $OpenBSD: install.md,v 1.71 2015/05/04 19:55:27 rpe Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -49,6 +49,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/sparc64/common/install.md b/distrib/sparc64/common/install.md index e8789d457dd..cdf32b97cf8 100644 --- a/distrib/sparc64/common/install.md +++ b/distrib/sparc64/common/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.42 2014/11/22 15:02:27 deraadt Exp $ +# $OpenBSD: install.md,v 1.43 2015/05/04 19:55:27 rpe Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -53,6 +53,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/vax/install.md b/distrib/vax/install.md index 52a03c43b17..dfcdb707620 100644 --- a/distrib/vax/install.md +++ b/distrib/vax/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.42 2014/03/22 02:24:43 krw Exp $ +# $OpenBSD: install.md,v 1.43 2015/05/04 19:55:27 rpe Exp $ # $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $ # # @@ -49,6 +49,11 @@ md_prep_disklabel() { _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]:" diff --git a/distrib/zaurus/ramdisk/install.md b/distrib/zaurus/ramdisk/install.md index a513a6eb9a3..ff00c3b1854 100644 --- a/distrib/zaurus/ramdisk/install.md +++ b/distrib/zaurus/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.31 2014/08/06 16:13:48 ajacoutot Exp $ +# $OpenBSD: install.md,v 1.32 2015/05/04 19:55:27 rpe Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -89,6 +89,11 @@ md_prep_disklabel() { _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]:" -- 2.20.1