aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2024-12-10 13:47:34 +0000
committerEd Maste <emaste@FreeBSD.org>2026-02-11 15:44:45 +0000
commit097458ac665db732cc91a22279da4cc14f694da2 (patch)
tree734627d2f7a0b6b1fe9e25eb91696706574ed240
parentc08ee1eba989b49c7c30945a551760eaeb2e3e15 (diff)
freebsd-update: Error for -b basedir without UNAME_r set
freebsd-update sets the currently running release from UNAME -r, which can be overridden via the --currently-running commandline option (or by setting UNAME_r in the environment). This may be invalid if -b is used to specify a basedir other than /, so error out if -b is specified without setting the currently running version. PR: 283229 Reviewed by: cperciva Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48016
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index aa42af13a302..a58b50e9ca2e 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -755,6 +755,10 @@ fetchupgrade_check_params () {
esac
chmod 700 ${WORKDIR}
cd ${WORKDIR} || exit 1
+ if [ "$BASEDIR" != / ] && [ -z "$UNAME_r" ]; then
+ echo "$(basename $0): -b basedir requires --currently-running to be specified."
+ exit 1
+ fi
# Generate release number. The s/SECURITY/RELEASE/ bit exists
# to provide an upgrade path for FreeBSD Update 1.x users, since