Re: svn commit: r343122 - head/usr.sbin/freebsd-update

2019-01-18 Thread Dag-Erling Smørgrav
Xin LI  writes:
> I think this would break upgrading from e.g. -BETA or -RC, which is supported?

Upgrading from -ALPHA is also supported.  Furthermore, expr(1) is a
better way of handling this than echo | grep, even if it only supports
basic REs; they are sufficient for this purpose.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r343122 - head/usr.sbin/freebsd-update

2019-01-17 Thread Ed Maste
On Thu, 17 Jan 2019 at 16:46, Xin LI  wrote:
>
> On Thu, Jan 17, 2019 at 1:39 PM Ed Maste  wrote:
>>
>> Author: emaste
>> Date: Thu Jan 17 21:38:57 2019
>> New Revision: 343122
>> URL: https://svnweb.freebsd.org/changeset/base/343122
>>
>> Log:
>>   freebsd-update: Clarify unsupported release upgrade error message
>
> I think this would break upgrading from e.g. -BETA or -RC, which is supported?

Indeed, followup coming shortly.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r343122 - head/usr.sbin/freebsd-update

2019-01-17 Thread Xin LI
On Thu, Jan 17, 2019 at 1:39 PM Ed Maste  wrote:

> Author: emaste
> Date: Thu Jan 17 21:38:57 2019
> New Revision: 343122
> URL: https://svnweb.freebsd.org/changeset/base/343122
>
> Log:
>   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).
>
>   PR:   234771
>   Submitted by: Gerald Aryeetey 
>   Reported by:  yuri
>   Reviewed by:  bcran
>   MFC after:1 month
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D18803
>
> Modified:
>   head/usr.sbin/freebsd-update/freebsd-update.sh
>
> Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
>
> ==
> --- head/usr.sbin/freebsd-update/freebsd-update.sh  Thu Jan 17
> 20:01:06 2019(r343121)
> +++ head/usr.sbin/freebsd-update/freebsd-update.sh  Thu Jan 17
> 21:38:57 2019(r343122)
> @@ -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
> @@ -442,7 +450,8 @@ parse_cmdline () {
> NOTTYOK=1
> ;;
> --currently-running)
> -   shift; export UNAME_r="$1"
> +   shift
> +   config_SourceRelease $1 || usage
> ;;
>
> # Configuration file equivalents
> @@ -657,6 +666,18 @@ fetchupgrade_check_params () {
> 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
>

I think this would break upgrading from e.g. -BETA or -RC, which is
supported?

Cheers,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343122 - head/usr.sbin/freebsd-update

2019-01-17 Thread Ed Maste
Author: emaste
Date: Thu Jan 17 21:38:57 2019
New Revision: 343122
URL: https://svnweb.freebsd.org/changeset/base/343122

Log:
  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).
  
  PR:   234771
  Submitted by: Gerald Aryeetey 
  Reported by:  yuri
  Reviewed by:  bcran
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D18803

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Thu Jan 17 20:01:06 
2019(r343121)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Thu Jan 17 21:38:57 
2019(r343122)
@@ -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
@@ -442,7 +450,8 @@ parse_cmdline () {
NOTTYOK=1
;;
--currently-running)
-   shift; export UNAME_r="$1"
+   shift
+   config_SourceRelease $1 || usage
;;
 
# Configuration file equivalents
@@ -657,6 +666,18 @@ fetchupgrade_check_params () {
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`
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"