sysupgrade -- saved documentation (t0055)
Source: pkgsrc/sysutils/sysupgrade (sysupgrade-1.5, pkgsrc patches applied:
  https allowed, ARCHIVE_EXTENSION tar.xz on x86_64, direct paths to
  etcupdate/postinstall); distfile build/distfiles/sysupgrade-1.5.tar.gz.
Read 2026-11-14.  What settles the questions of the task:

1. RELEASEDIR (sysupgrade.conf.5): "Location of the release directory (which
   must hold a binary/sets/ subdirectory).  This can be either a local path or
   a URL.  If the location is a URL, any of the HTTP, FTP or SSH protocols are
   supported."  -> file:// is NOT among them.  sysupgrade.sh sysupgrade_fetch():
   cases ftp://*|http://* (https:// after the pkgsrc patch), ssh://*, /* (an
   absolute path: the files are symlinked into the cache), anything else:
   "Don't know how to fetch from ..., must be an absolute path or an FTP/HTTP
   site".  So a file:// URL has to become a path before sysupgrade sees it.
2. Files fetched: binary/sets/<set>.<ARCHIVE_EXTENSION> for every set in SETS,
   and binary/kernel/netbsd-<KERNEL>.gz.  Makronix's release has exactly that
   layout (build/obj/releasedir/amd64/binary/{sets/*.tar.xz,kernel/netbsd-*.gz}).
3. SETS (conf.5): "If this is set to the magic value AUTO, the list of sets is
   determined from the files in <DESTDIR>/etc/mtree."  etc/mtree/set.makronix
   exists in the destdir, so the makronix set is upgraded with the others.
   "The presence of any configuration sets (such as etc or xetc) in this list
   enables the etcupdate and postinstall steps."
4. KERNEL (conf.5): "AUTO: attempt to automatically determine the name of the
   current kernel by using config(1) on <DESTDIR>/netbsd" -- needs config(1)
   from the comp set; a Makronix system without comp must name it (GENERIC).
5. POSTINSTALL_AUTOFIX (conf.5): "It is recommended that you include 'obsolete'
   in this list at the very least."
6. ETCUPDATE: "the only interactive step in the upgrade process".
7. CACHEDIR default ${VARBASE}/cache/sysupgrade; AUTOCLEAN deletes the
   downloaded files after `auto'.
Binary packages of the NetBSD project (x86_64, 11.0_2026Q3):
   sysupgrade-1.5nb12.tgz, shtk-1.7.tgz (HTTP 200, 2026-11-14).

--- sysupgrade.conf(5) as shipped ---
.Dd October 10, 2012
.Dt SYSUPGRADE.CONF 5
.Os
.Sh NAME
.Nm sysupgrade.conf
.Nd configuration file to control NetBSD system upgrades
.Sh DESCRIPTION
Configuration files for
.Xr sysupgrade 8
are simple shell scripts that set, or explicitly clear, a collection of known
configuration variables.
.Pp
The following configuration variables are recognized:
.Bl -tag
.It Va AUTOCLEAN
Whether to automatically delete the downloaded files or not as part of the
.Sq auto
command.
.Pp
If you set
.Va ETCUPDATE
to false, you will probably want to disable autocleaning.
This will let you run the
.Sq etcupdate
command on your own at a later stage reusing the same distribution sets used to
upgrade the system.
.Pp
Default: yes.
.It Va CACHEDIR
Path to the local directory into which distribution sets are temporarily fetched
while applying a system upgrade.
Note that all
.Nm
commands that need access to the distribution sets (pretty much all of them)
will read from this directory.
If you plan on issuing different upgrade steps at different times, this
directory should persist across the different executions.
.Pp
Default:
.Pa __SYSUPGRADE_CACHEDIR__
.It Va DESTDIR
Path to the root of the system to be upgraded.
This is prepended to all other paths affected by
.Xr sysupgrade 8
and can be used to perform upgrades of non-live systems or for testing
purposes.
.Pp
Default: not set (which means
.Pa /
is affected).
.It Va ETCUPDATE
Whether to run
.Xr etcupdate 8
as part of an automated upgrade.
You may want to disable this because this is the only interactive step in the
upgrade process.
.Pp
If set to false, the
.Sq auto
subcommand will skip this step.
In this case, you are also recommended to set
.Va AUTOCLEAN
to
.Sq no
so that you are not required to redownload the distribution files just to run
.Xr etcupdate 8
later.
.Pp
Default: yes.
.It Va KERNEL
Name of the kernel to install.
There must be a
.Sq netbsd-<KERNEL>.gz
file in the release directory matching this name.
.Pp
If this is set to the magic value
.Sq AUTO ,
.Xr sysupgrade 8
will attempt to automatically determine the name of the current kernel by using
.Xr config 1
on
.Pa <DESTDIR>/netbsd .
If the guessing fails, an error is raised to prevent installing a mismatching
kernel.
.Pp
Default: AUTO.
.It Va POSTINSTALL_AUTOFIX
Whitespace-separated list of
.Xr postinstall 8
checks that will be unconditionally fixed as part of an upgrade.
.Pp
It is recommended that you include
.Sq obsolete
in this list at the very least: this check often fails because it is common for
newer releases to drop existing files, and fixing it should be harmless.
Note that old shared libraries are never cleaned by this check, so existing
third-party binaries should not stop working even after auto-fixing this check.
.Pp
Default: empty.
.It Va RELEASEDIR
Location of the release directory (which must hold a
.Pa binary/sets/
subdirectory).
This can be either a local path or a URL.
.Pp
If the location is a URL, any of the HTTP, FTP or SSH protocols are supported.
In the case of SSH, the URL takes the form:
.Sq ssh://[user[:password]@]<host>/<absolute_path> ,
which is different to the syntax accepted by
.Xr scp 1 .
.Pp
Default: not set.
.It Va SETS
Whitespace-separated list of distribution sets to install.
If this is set to the magic value
.Sq AUTO ,
the list of sets is determined from the files in
.Pa <DESTDIR>/etc/mtree .
.Pp
This list cannot include any
.Sq kern-*
sets; the kernel to be installed is determined by the
.Va KERNEL
variable.
.Pp
The presence of any configuration sets (such as
.Sq etc
or
.Sq xetc )
in this list enables the etcupdate and postinstall steps in the automated
upgrade procedure.
.Pp
The presence of a modules set enables the modules step in the automated upgrade
procedure.
.Pp
Default: AUTO.
.El
.Sh SEE ALSO
.Xr sysupgrade 8

--- default.conf as shipped ---
# $NetBSD: default.conf,v 1.2 2012/10/11 00:16:46 jmmv Exp $

# Configuration of automatic system upgrades by sysupgrade(8).
#
# See sysupgrade.conf(5) for details on the syntax of this file and the
# meaning of the configuration variables.  Note that not all the supported
# configuration variables are listed in this sample configuration file.

# Path to the release files (local path or remote URL).
#RELEASEDIR="ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-6.0/$(uname -m)"
#RELEASEDIR="ssh://me@builder.example.net/home/sysbuild/release/$(uname -m)"
RELEASEDIR="/home/sysbuild/release/$(uname -m)"

# Name of the kernel to be installed.
KERNEL=AUTO  # Guess from /netbsd (requires config(1)).

# Whitespace-separated list of sets to install.
SETS=AUTO  # Guess from /etc/mtree/set.* files.

# Whitespace-separated list of postinstall(8) checks to automatically fix.
POSTINSTALL_AUTOFIX="obsolete"

# Whether to run etcupdate or not as part of an upgrade.
#
# Running etcupdate is the only interactive step in the upgrade process, so
# setting this variable to 'no' effectively makes upgrades unattended.  You
# can later run etcupdate at a later step by hand.
#ETCUPDATE=no

# Whether to delete the downloaded files after an upgrade or not.
#
# If you set ETCUPDATE=no, you will most likely want to disable
# auto-cleaning as well.  The reason for this is that, if you want to later
# do "sysupgrade etcupdate" using the same etc.tgz file downloaded during
# the upgrade, you will need the same etc.tgz file to be present.
#AUTOCLEAN=no

--- 2026-11-15: measured in this tree (t0055) ---

The points above are the manual's sentences; these are measurements in this
tree and the pkgsrc patches of the same distfile.  Nothing replaced: the text
above stands as read on 2026-11-14.

a. KERNEL=AUTO does not only "need config(1)" -- on Makronix it fails.
   `config` is not a live file of the sets: "./usr/sbin/config" and
   "./usr/sbin/config.new" are `comp-obsolete obsolete`
   (src/distrib/sets/lists/comp/mi:4719-4720), and there is no
   build/obj/destdir.amd64/usr/sbin/config.  sysupgrade.sh:79-86 runs
   `config -x <DESTDIR>/netbsd`, gets nothing, and stops with "Failed to
   determine kernel name; please set KERNEL explicitly" -- an error, not a
   silent skip.  Our configuration names the kernel (amd64: GENERIC, the
   binary/kernel/netbsd-GENERIC.gz of the release).

b. The configuration file is not on an installed system.  pkgsrc's recipe
   copies the example through CONF_FILES
   (pkgsrc/sysutils/sysupgrade/Makefile:26), which is a pkg_add action;
   the makronix set is unpacked with its METALOG and carries only
   /usr/pkg/share/examples/sysupgrade/default.conf (measured: no
   usr/pkg/etc/sysupgrade.conf in build/obj/destdir.amd64).  A missing file
   is fatal: shtk_config_load stops with "Configuration file ... does not
   exist" (share/shtk/config.subr:176-181 in the destdir).  So the upgrade
   command passes `-c` a file of its own; it cannot rely on the default path.

c. The pkgsrc default.conf is not our source: patch-default.conf replaces the
   examples with https URLs of cdn.NetBSD.org and nycdn.netbsd.org (daily
   snapshots, `netbsd-$(uname -r | cut -d. -f1)`).

d. ARCHIVE_EXTENSION (pkgsrc's addition, PR pkg/53697) is `tar.xz` on x86_64
   and `sparc64` and `tgz` elsewhere (patch-sysupgrade.sh).  The release in
   this tree matches it without an override: 24 `*.tar.xz` sets under
   build/obj/releasedir/amd64/binary/sets and the kernels under
   binary/kernel (measured 2026-11-15).

e. On the installed system the program is /usr/pkg/sbin/sysupgrade (17447
   bytes in the destdir) plus shtk with /usr/pkg/share/shtk/*.subr -- the
   NetBSD binary of packages.list:48, unpatched by us.

f. The cache directory of the package is /var/cache/sysupgrade: pkgsrc
   configures SYSUPGRADE_CACHEDIR=${VARBASE}/cache/sysupgrade and creates it
   0755 (pkgsrc/sysutils/sysupgrade/Makefile:18-20).

g. Nothing verifies a set: the fetch is `ftp(1)` and the extraction is
   `progress -zf FILE | tar -xp` (sysupgrade.sh:177; `tar -xJp` for tar.xz in
   pkgsrc's patch).  SHA512/MD5 next to the sets are not read.  t0078,
   docs/reference/update-verification.txt.

Still not measured: a sysupgrade run on an installed Makronix (no VM has done
it), its duration, what etcupdate asks in this tree's /etc, and the
encrypted-root hook of docs/UPDATING.md ("the gap").
