Index | Thread | Search

From:
obsd@mulh.net
Subject:
Allow autoinstall response file to select default answer
To:
tech@openbsd.org
Date:
Sun, 4 Oct 2026 20:19:56 -0400

Download raw body.

Thread
I would like to propose a change to install.sub to
allow an autoinstall response file to be able to
select the default answer to a question.

The use case is for when using multiple sets locations.

Example:
First sets location is the CD image (or HTTP mirror).
The default "Pathname to the sets" varies by OpenBSD version.
Second sets location is a local path with the site*.tgz files.

Problem:
Need to install the main OpenBSD sets "before" the local site sets.
So how do you accept defaults for the main sets but then specify
specifics for local files?

Currently:
If I want to specify a path for the local site* files
I must also specify the CD's sets path (and update the response
file when using a different installation ISO).
  or
Create multiple local paths matching the CD's default paths and
put the site* files (or links) there. (and no location lines
in the response file)
  or
Create many slightly different response files and update dhcpd.conf
to select the version I'm needing.

Solution:
install.sub currently ignores "key=" (no value part) lines in the
response file.  Make it so a blank value selects the default answer.

This would allow for example:
  Location of sets = cd
  Pathname to the sets =
  Set name(s) =
  Directory does not contain = yes
  Location of sets = nfs
  Server IP address = local.example.org
  Filesystem on server = share
  Pathname to the sets = path/to/site/files
  Set name(s) = site*.tgz
  Directory does not contain = yes

I had been testing this change by booting bsd.rd, going to
(S)hell, edit the install.sub and exit to restart installer.

PS: Is it to soon to be making requests for future releases?


Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
diff -u -p -u -r1.1292 install.sub
--- install.sub	19 Sep 2026 19:52:10 -0000	1.1292
+++ install.sub	4 Oct 2026 22:55:49 -0000
@@ -740,11 +740,16 @@ _autorespond() {
 
 	mv /tmp/ai/ai.conf /tmp/ai/ai.conf.tmp
 	while IFS=' 	' read -r _l; do
-		[[ $_l == [!#=]*=?* ]] || continue
+		[[ $_l == [!#=]*=* ]] || continue
 		_key=${_l%%*([[:blank:]])=*}
 		_val=${_l##*([!=])=*([[:blank:]])}
 		[[ $_q == @(|*[[:blank:]])"$_key"@([[:blank:]?]*|) ]] &&
-			resp=$_val && cat && return
+			resp=$_val && cat &&
+				if [[ -n $resp ]] then
+					return
+				else
+					break
+				fi
 		print -r " $_l"
 	done </tmp/ai/ai.conf.tmp >/tmp/ai/ai.conf
 	[[ -n $_def ]] && resp=$_def && return