Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
sysupgrade: allow invalid version with -f and -R
To:
OpenBSD tech <tech@openbsd.org>
Date:
Sun, 06 Jul 2025 12:48:34 +0200

Download raw body.

Thread
tech@,

I spent some time testing for a possible bug by installing different
snapshots from https://openbsd.cs.toronto.edu/archive/.

To simplify the process, I added a way to install a snapshot directly
using sysupgrade:

    sysupgrade -f -R 2025-06-18 https://openbsd.cs.toronto.edu/archive

I have used similar hacks to easily install snapshots from the archive a
few times over the last year, and I think the diff below is worth adding.

Thoughts? Ok?

Index: usr.sbin/sysupgrade/sysupgrade.sh
===================================================================
RCS file: /home/cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
diff -u -p -r1.58 sysupgrade.sh
--- usr.sbin/sysupgrade/sysupgrade.sh	3 Feb 2025 18:55:55 -0000	1.58
+++ usr.sbin/sysupgrade/sysupgrade.sh	6 Jul 2025 10:45:31 -0000
@@ -92,7 +92,7 @@ while getopts b:fknrR:s arg; do
 	r)	;;
 	R)	FORCE_VERSION=true
 		[[ ${OPTARG} == @([0-9]|[0-9][0-9]).[0-9] ]] ||
-		    err "invalid version: ${OPTARG}"
+		    $FORCE || err "invalid version: ${OPTARG}"
 		NEXT_VERSION=${OPTARG};;
 	s)	SNAP=true;;
 	*)	usage;;
@@ -115,8 +115,8 @@ esac
 	FILE=true
 $FORCE_VERSION && $SNAP &&
 	err "incompatible options: -s -R $NEXT_VERSION"
-$FORCE && ! $SNAP &&
-	err "incompatible options: -f without -s"
+$FORCE && ! $FORCE_VERSION && ! $SNAP &&
+	err "incompatible options: -f without -s or -R"

 if $SNAP; then
 	WHAT='snapshot'