summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2019-04-22 05:36:43 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2019-04-22 05:36:43 +0000
commitf53037deefcc0e3fb108fa7e21f9f40a607e591f (patch)
tree70b2ae18b543ed863255f61172c0be2a85e865bf
parentc8148fe1563be73c9971e8b4219f0e3158c5bbfd (diff)
When upgrading only prompt for disks that contain a root partition.
With this the question "Which disk is the root disk" has the correct default in case of full disk encryption. Before it would list sd0 sd1 with sd0 being the backing store and sd1 the unlocked disk. This is a step towards fully unattended upgrades running completely on defaults (i.e. no need for an autoinstall(8) answer file). In the past there have been concernes that we should not touch any odd disk without the operator telling us as there might be bugs lurking. It is early enough in the cycle to find out for sure. input halex, kn "just commit it" deraadt
-rw-r--r--distrib/miniroot/install.sub18
1 files changed, 15 insertions, 3 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 6b4e9af612a..b149729b9a9 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1113 2019/04/02 08:51:49 deraadt Exp $
+# $OpenBSD: install.sub,v 1.1114 2019/04/22 05:36:42 florian Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -333,6 +333,18 @@ get_dkdevs_uninitialized() {
bsort $_disks
}
+# Return list of valid root disks
+get_dkdevs_root() {
+ local _disks=$(get_dkdevs) _d
+
+ if [[ $MODE == upgrade ]]; then
+ for _d in $_disks; do
+ is_rootdisk "$_d" || _disks=$(rmel "$_d" $_disks)
+ done
+ fi
+ echo -n $_disks
+}
+
# Return list of all network devices, optionally limited by parameters to
# ifconfig. Filter out dynamically created network pseudo-devices except vlan.
get_ifs() {
@@ -2241,11 +2253,11 @@ is_rootdisk() {
# Get global root information. ie. ROOTDISK, ROOTDEV and SWAPDEV.
get_rootinfo() {
- local _default=$(get_dkdevs) _dkdev
+ local _default=$(get_dkdevs_root) _dkdev
local _q="Which disk is the root disk? ('?' for details)"
while :; do
- echo "Available disks are: $(get_dkdevs | sed 's/^$/none/')."
+ echo "Available disks are: $(get_dkdevs_root | sed 's/^$/none/')."
_ask "$_q" $_default || continue
case $resp in
"?") diskinfo $(get_dkdevs);;