Skip to content

Commit

Permalink
freebsd-update: Clarify unsupported release upgrade error message
Browse files Browse the repository at this point in the history
Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

PR:		234771
Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by:	yuri
Reviewed by:	bcran
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18803
  • Loading branch information
emaste committed Jan 17, 2019
1 parent b336c7b commit bffa924
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion usr.sbin/freebsd-update/freebsd-update.sh
Expand Up @@ -304,6 +304,14 @@ config_TargetRelease () {
fi
}

# Pretend current release is FreeBSD $1
config_SourceRelease () {
UNAME_r=$1
if echo ${UNAME_r} | grep -qE '^[0-9.]+$'; then
UNAME_r="${UNAME_r}-RELEASE"
fi
}

# Define what happens to output of utilities
config_VerboseLevel () {
if [ -z ${VERBOSELEVEL} ]; then
Expand Down Expand Up @@ -442,7 +450,8 @@ parse_cmdline () {
NOTTYOK=1
;;
--currently-running)
shift; export UNAME_r="$1"
shift
config_SourceRelease $1 || usage
;;

# Configuration file equivalents
Expand Down Expand Up @@ -658,6 +667,18 @@ fetchupgrade_check_params () {
FETCHDIR=${RELNUM}/${ARCH}
PATCHDIR=${RELNUM}/${ARCH}/bp

# Disallow upgrade from a version that is not `-RELEASE`
if ! echo "${RELNUM}" | grep -qE -- "-RELEASE$"; then
echo -n "`basename $0`: "
cat <<- EOF
Cannot upgrade from a version that is not a '-RELEASE' using `basename $0`.
Instead, FreeBSD can be directly upgraded by source or upgraded to a
RELEASE/RELENG version prior to running `basename $0`.
EOF
echo "System version: ${RELNUM}"
exit 1
fi

# Figure out what directory contains the running kernel
BOOTFILE=`sysctl -n kern.bootfile`
KERNELDIR=${BOOTFILE%/kernel}
Expand Down

4 comments on commit bffa924

@skarekrow
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit seems to break the currently-running flag, requiring us to specify UNAME_r in the env instead

@emaste
Copy link
Member Author

@emaste emaste commented on bffa924 Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a review open for an update, will mention this there
https://reviews.freebsd.org/D18881

@emaste
Copy link
Member Author

@emaste emaste commented on bffa924 Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skarekrow
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was quick, thanks!

Please sign in to comment.