Index | Thread | Search

From:
obsd@mulh.net
Subject:
Re: Allow autoinstall response file to select default answer
To:
tech@openbsd.org
Date:
Wed, 7 Oct 2026 15:40:05 -0400

Download raw body.

Thread
On 2026-10-06 16:54:22, Stuart wrote:
> space is *seriously* limited in some install media).

Here is a revised patch for consideration.
Same behaviour and allows for default answer.

install.sub shrinks by three bytes, so no space cost.


Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
diff -u -p -r1.1292 install.sub
--- install.sub	19 Sep 2026 19:52:10 -0000	1.1292
+++ install.sub	7 Oct 2026 19:19:00 -0000
@@ -738,17 +738,17 @@ _autorespond() {
 
 	[[ -f $AI_RESPFILE && -n $_q ]] || return
 
+	resp=$_def
 	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:-$_def} && cat && break
 		print -r " $_l"
 	done </tmp/ai/ai.conf.tmp >/tmp/ai/ai.conf
-	[[ -n $_def ]] && resp=$_def && return
-	err_exit "\nQuestion has no answer in response file: \"$_q\""
+	[[ -n $resp ]] || err_exit "\nQuestion has no answer in response file: \"$_q\""
 }
 
 # Capture user response either by issuing an interactive read or by searching