From: kn Date: Thu, 2 Feb 2023 13:29:16 +0000 (+0000) Subject: Move existing softraid check into reusable function X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dda200cbadcf286fc6b517d39ffaafa849262116;p=openbsd Move existing softraid check into reusable function No behaviour change, but get_softraid_chunks() reads much clearer. The root disk is checked to be a softraid volume; if so, devices for each chunks are created to make installboot work later. bioctl accepts "sd1" and "softraid0", the latter prints all volumes. Output is identical if sd1 is the only volume. OK afresh1 --- diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 9140c333c1e..acc8f0e92f5 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1223 2023/01/28 18:44:31 phessler Exp $ +# $OpenBSD: install.sub,v 1.1224 2023/02/02 13:29:16 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -346,6 +346,13 @@ get_dkdevs_root() { echo -n $_disks } +# Return list of softraid chunks, optionally limited to the volume $1. +get_softraid_chunks() { + local _device=${1:-softraid0} + + bioctl $_device 2>/dev/null | sed -n 's/.*<\(.*\)>$/\1/p' +} + # Return list of all network devices, optionally limited by parameters to # ifconfig. Filter out dynamically created network pseudo-devices except vlan. get_ifs() { @@ -2947,7 +2954,7 @@ finish_up() { # In case this is a softraid device, make sure all underlying # device nodes exist before installing boot-blocks on disk. - make_dev $(bioctl $ROOTDISK 2>/dev/null | sed -n 's/.*<\(.*\)>$/\1/p') + make_dev $(get_softraid_chunks $ROOTDISK) md_installboot $ROOTDISK chmod og-rwx /mnt/bsd{,.mp,.rd} 2>/dev/null