When upgrading to releases, the installer fills rc.firsttime(8) with
a syspatch(8) snippet possibly displaying available patches.
That snippet itself checks for a release version as well as an existent
installurl(5) file as a precondition for syspatch, see the diff below.
syspatch, however, has code to fallback to cdn.o.o without a valid URL:
286 _MIRROR=$(while read _line; do _line=${_line%%#*}; [[ -n ${_line} ]] &&
287 print -r -- "${_line}"; done </etc/installurl | tail -1) 2>/dev/null
288 [[ ${_MIRROR} == @(file|ftp|http|https)://* ]] ||
289 _MIRROR=https://cdn.openbsd.org/pub/OpenBSD
290 _MIRROR="${_MIRROR}/syspatch/${_KERNV[0]}/$(machine)"
Furthermore, the installer actively sets a working URL if needed, in the
same finish_up() function shortly before placing the syspatch snippet:
2842 # Create /etc/installurl if it does not yet exist.
2843 if [[ ! -f /mnt/etc/installurl ]]; then
2844 echo "${INSTALL_URL:-https://cdn.openbsd.org/pub/OpenBSD}" \
2845 >/mnt/etc/installurl
2846 fi
So one of the following is true for installurl:
1. exists but has no valid URL, then syspatch falls back to cdn.o.o
2. exists and has a valid URL, then syspatch uses that
3. does not exist so the installer creates it with cdn.o.o, see 2.
In the unlikely case that the install/upgrade finishes, i.e. installurl
does exist, but gets removed or truncated before rc.firsttime runs, the
existing check would actually prevent syspatch from running even though
it copes with such files.
So just remove the useless check.
OK aja
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1211 2022/10/10 11:04:17 kn Exp $
+# $OpenBSD: install.sub,v 1.1212 2022/10/16 08:47:20 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
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 ]]; then
+if ((${#_KERNV[*]} == 1)); then
echo "Checking for available binary patches..."
_CKPATCH=$(syspatch -c)
if [[ -n $_CKPATCH ]]; then