Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Mar 2019 19:01:57 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r344814 - stable/12/usr.sbin/freebsd-update
Message-ID:  <201903051901.x25J1vFl060255@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Mar  5 19:01:57 2019
New Revision: 344814
URL: https://svnweb.freebsd.org/changeset/base/344814

Log:
  MFC freebsd-update: Clarify unsupported release upgrade error message
  
  MFC r343122:
  
  freebsd-update: Clarify unsupported release upgrade error message
  
  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).
  
  Reported by:	yuri
  Reviewed by:	bcran
  
  MFC r343268:
  
  frebsd-update: fix --currently-running after r343122
  
  Reported by:	Brandon Schneider
  
  MFC rr343271:
  
  freebsd-update: Allow upgrade from pre-release builds
  
  Update r343122 to include -ALPHA, -BETA and -RC releases as
  upgrade-able via freebsd-update.
  
  Reported by:	delphij, des
  Reviewed by:	delphij
  
  PR:		234771
  Submitted by:	Gerald Aryeetey <aryeeteygerald_rogers.com>
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- stable/12/usr.sbin/freebsd-update/freebsd-update.sh	Tue Mar  5 18:54:47 2019	(r344813)
+++ stable/12/usr.sbin/freebsd-update/freebsd-update.sh	Tue Mar  5 19:01:57 2019	(r344814)
@@ -304,6 +304,15 @@ 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
+	export UNAME_r
+}
+
 # Define what happens to output of utilities
 config_VerboseLevel () {
 	if [ -z ${VERBOSELEVEL} ]; then
@@ -442,7 +451,8 @@ parse_cmdline () {
 			NOTTYOK=1
 			;;
 		--currently-running)
-			shift; export UNAME_r="$1"
+			shift
+			config_SourceRelease $1 || usage
 			;;
 
 		# Configuration file equivalents
@@ -657,6 +667,24 @@ fetchupgrade_check_params () {
 	ARCH=`uname -m`
 	FETCHDIR=${RELNUM}/${ARCH}
 	PATCHDIR=${RELNUM}/${ARCH}/bp
+
+	# Disallow upgrade from a version that is not a release
+	case ${RELNUM} in
+		*-RELEASE | *-ALPHA*  | *-BETA* | *-RC*)
+			;;
+		*)
+			echo -n "`basename $0`: "
+			cat <<- EOF
+				Cannot upgrade from a version that is not a release
+				(including alpha, beta and release candidates)
+				using `basename $0`. Instead, FreeBSD can be directly
+				upgraded by source or upgraded to a RELEASE/RELENG version
+				prior to running `basename $0`.
+				Currently running: ${RELNUM}
+			EOF
+			exit 1
+			;;
+	esac
 
 	# Figure out what directory contains the running kernel
 	BOOTFILE=`sysctl -n kern.bootfile`



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903051901.x25J1vFl060255>