Index | Thread | Search

From:
Florian Obser <florian@openbsd.org>
Subject:
Re: sysupgrade -S siteXY.tgz
To:
tech@openbsd.org
Date:
Fri, 12 Jun 2026 19:51:54 +0200

Download raw body.

Thread
On 2026-06-12 19:01 +02, Stefan Sperling <stsp@stsp.name> wrote:
> At present, a site set with custom files must be uploaded to the same
> mirror which base sets are fetched from. Else the site set is not
> available during installation and upgrades. This makes it a bit
> difficult to use official installation mirrors with site sets during
> upgrades since a custom mirror is required to serve the site set from.

This sounds useful; maybe you can trick someone who actually understands
shell scripts to do a review?

Two comments inline.

>
>
>  add support for custom site sets to sysupgrade
>  
> M  usr.sbin/sysupgrade/sysupgrade.8   |   7+  0-
> M  usr.sbin/sysupgrade/sysupgrade.sh  |  18+  3-
>
> 2 files changed, 25 insertions(+), 3 deletions(-)
>
> commit - b5f1a9c5e77f3bfe0e6eed9fcd0cf0c458ccac64
> commit + b974289573def6a011ddb7b1456b120de0c9cafc
> blob - 41438ad98167851b352ac80e274b7b4d347fe219
> blob + b32efa8b370cde5425d834bd2e65c33be3e2e277
> --- usr.sbin/sysupgrade/sysupgrade.8
> +++ usr.sbin/sysupgrade/sysupgrade.8
> @@ -25,6 +25,7 @@
>  .Op Fl fkns
>  .Op Fl b Ar base-directory
>  .Op Fl R Ar version
> +.Op Fl S Ar siteXY.tgz
>  .Op Ar installurl | path
>  .Sh DESCRIPTION
>  .Nm
> @@ -73,6 +74,12 @@ Downgrading is unlikely to work.
>  .It Fl s
>  Upgrade to a snapshot.
>  The default is to upgrade to the next release.
> +.It Fl S Ar siteXY.tgz
> +Install a custom
> +.Ar siteXY.tgz
> +set during the upgrade in addition to the regular
> +.Ox
> +release sets.
>  .El
>  .Pp
>  When updating to a release or snapshot which lacks the required signify
> blob - 6d893e5f9e245140768c595fddcc4b7e274ea95d
> blob + 482fe3dd0b1ea2d3af1fc1ebf7d77223b989c023
> --- usr.sbin/sysupgrade/sysupgrade.sh
> +++ usr.sbin/sysupgrade/sysupgrade.sh
> @@ -35,7 +35,7 @@ err()
>  
>  usage()
>  {
> -	echo "usage: ${0##*/} [-fkns] [-b base-directory] [-R version] [installurl | path]" 1>&2
> +	echo "usage: ${0##*/} [-fkns] [-b base-directory] [-R version] [-S siteXY.tgz] [installurl | path]" 1>&2
>  	return 1
>  }
>  
> @@ -79,11 +79,13 @@ FORCE_VERSION=false
>  KEEP=false
>  REBOOT=true
>  WHAT='release'
> +PATH_SITESET=''
> +SITESET=''
>  
>  VERSION=$(uname -r)
>  NEXT_VERSION=$(echo ${VERSION} + 0.1 | bc)
>  
> -while getopts b:fknrR:s arg; do
> +while getopts b:fknrR:sS: arg; do
>  	case ${arg} in
>  	b)	SETSDIR=${OPTARG}/_sysupgrade;;
>  	f)	FORCE=true;;
> @@ -95,6 +97,11 @@ while getopts b:fknrR:s arg; do
>  		    err "invalid version: ${OPTARG}"
>  		NEXT_VERSION=${OPTARG};;
>  	s)	SNAP=true;;
> +	S)	PATH_SITESET=$(realpath "${OPTARG}");
> +		SITESET=$(basename "${OPTARG}");
> +		[[ "${SITESET}" == @(site[0-9][0-9].tgz) ]] || 

trailing whitespace

> +		    err "invalid site set: ${OPTARG}";
> +		;;
>  	*)	usage;;
>  	esac
>  done
> @@ -218,14 +225,22 @@ if [[ -n ${DL} ]]; then
>  	unpriv cksum -qC SHA256 ${DL}
>  fi
>  
> +if [ -n "${PATH_SITESET}" ]; then
> +	cp ${PATH_SITESET} .
> +	ls -l > index.txt

why do you need index.txt? As far as I can work out it's only being used
by install_http() and sysupgrade doesn't end up there?

> +fi
> +
>  cat <<__EOT >/auto_upgrade.conf
>  Location of sets = disk
>  Pathname to the sets = ${SETSDIR}/
>  Directory does not contain SHA256.sig. Continue without verification = yes
>  __EOT
> +if [ -n "${SITESET}" ]; then
> +	echo "Set name(s) = +${SITESET}" >>/auto_upgrade.conf
> +fi
>  
>  if ! ${KEEP}; then
> -	CLEAN=$(echo BUILDINFO SHA256 ${SETS} | sed -e 's/ /,/g')
> +	CLEAN=$(echo BUILDINFO SHA256 ${SETS} index.txt ${SITESET} | sed -e 's/ /,/g')
>  	cat <<__EOT > /etc/rc.firsttime
>  rm -f ${SETSDIR}/{${CLEAN}}
>  __EOT
>

-- 
In my defence, I have been left unsupervised.