The delimiter can be quoted (single or double) to disable parameter,
command and arithmetic expansion inside the here document:

        $ cat <<__EOT
        echo $(echo foo)
        __EOT
        echo foo

        $ cat <<'__EOT'   
        echo $(echo foo)
        __EOT
        echo $(echo foo)

Do the latter to be able to write the here document/file content exactly
as it would end up in output/rc.firsttime, making it easier to read.

To be more consistent and explicit, switch the remaining here documents
with pure plain text (no shell expansion, etc.) to quoted delimiters.

I double checked the output to be identical (modulo the indentation fix
to distinguish the continued if condition from the if body).

OK? (for after release)


Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1205
diff -u -p -r1.1205 install.sub
--- install.sub 19 Sep 2022 15:40:36 -0000      1.1205
+++ install.sub 20 Sep 2022 11:32:05 -0000
@@ -1434,7 +1434,7 @@ select_sets() {
        # account for 4 spaces added to the sets list
        let COLUMNS=_col-8
 
-       cat <<__EOT
+       cat <<'__EOT'
 
 Select sets by entering a set name, a file name pattern or 'all'. De-select
 sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
@@ -2902,18 +2902,18 @@ finish_up() {
        # Run syspatch -c on reboot if the arch is supported and if it is a
        # release system (not -stable or -current). List uninstalled syspatches
        # on the console and in the rc.firsttime output mail.
-       isin "$ARCH" $_syspatch_archs && cat <<__EOT >>/mnt/etc/rc.firsttime
-set -A _KERNV -- \$(sysctl -n kern.version |
+       isin "$ARCH" $_syspatch_archs && cat <<'__EOT' >>/mnt/etc/rc.firsttime
+set -A _KERNV -- $(sysctl -n kern.version |
        sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
-if ((\${#_KERNV[*]} == 1)) && [[ -s /etc/installurl ]] &&
-       _CKPATCH=\$(mktemp /tmp/_ckpatch.XXXXXXXXXX); then
+if ((${#_KERNV[*]} == 1)) && [[ -s /etc/installurl ]] &&
+    _CKPATCH=$(mktemp /tmp/_ckpatch.XXXXXXXXXX); then
        echo "Checking for available binary patches..."
-       syspatch -c > \$_CKPATCH
-       if [[ -s \$_CKPATCH ]]; then
+       syspatch -c > $_CKPATCH
+       if [[ -s $_CKPATCH ]]; then
                echo "Run syspatch(8) to install:"
-               column -xc 80 \$_CKPATCH
+               column -xc 80 $_CKPATCH
        fi
-       rm -f \$_CKPATCH
+       rm -f $_CKPATCH
 fi
 __EOT
 
@@ -3497,7 +3497,7 @@ export COLUMNS=$(stty -a </dev/console |
 
 # Interactive or automatic installation?
 if ! $AI; then
-       cat <<__EOT
+       cat <<'__EOT'
 At any prompt except password prompts you can escape to a shell by
 typing '!'. Default answers are shown in []'s and are selected by
 pressing RETURN.  You can exit this program at any time by pressing

Reply via email to