Hacking on the installer while running it is a lot easier when you can
inspect or run functions directly without paging the whole script or
poking around in it with ed.
install.sub is already structured so that all functions come first,
then MD code, then actual commands.
Copy FUNCS_ONLY from rc.subr(8) so you can drop out any time and hack around
more conveniently:
Available disks are: sd0 sd1.
Which disk is the root disk? ('?' for details) [sd0] !
Type 'exit' to return to install.
test# FUNCS_ONLY=1 . /install.sub
test# typeset -f get_dkdevs
get_dkdevs() {
echo $(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}")
}
test# get_dkdevs
sd0 sd1
test#
This requires the sourcing shell to be ksh(1) or sh(1) with 'strict Bourne
shell mode' disabled. '!' is ksh now, but the initial (S)hell answer still
lands in a strict (default) sh(1) -- that can/should be fixed separately.
OK deraadt
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1220 2023/01/17 16:14:23 kn Exp $
+# $OpenBSD: install.sub,v 1.1221 2023/01/17 16:22:56 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
set +m
}
+# return if we only want internal functions
+[[ -n $FUNCS_ONLY ]] && return
+
# ------------------------------------------------------------------------------
# Initial actions common to both installs and upgrades.
#