CVSROOT:        /cvs
Module name:    src
Changes by:     k...@cvs.openbsd.org    2022/10/16 02:47:21

Modified files:
        distrib/miniroot: install.sub 

Log message:
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 </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

Reply via email to