Index: head/usr.sbin/freebsd-update/freebsd-update.sh =================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh +++ head/usr.sbin/freebsd-update/freebsd-update.sh @@ -304,6 +304,14 @@ 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 @@ -442,7 +450,8 @@ NOTTYOK=1 ;; --currently-running) - shift; export UNAME_r="$1" + shift + config_SourceRelease $1 || usage ;; # Configuration file equivalents @@ -657,6 +666,18 @@ ARCH=`uname -m` 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`