From: kn Date: Sun, 16 Oct 2022 08:47:20 +0000 (+0000) Subject: Leave installurl handling to syspatch(8) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7fae021aca81205d061d3d2b405111a1ab7d9c88;p=openbsd Leave installurl handling to syspatch(8) 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 /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 --- diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 26d00cdb082..2665e66eae3 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/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 @@ -2905,7 +2905,7 @@ finish_up() { 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