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
This commit is contained in:
Ed Maste
2024-12-10 08:47:34 -05:00
parent c08ee1eba9
commit 097458ac66
@@ -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