Bug 240757 - freebsd-update: Add upgradesready and showconfig commands, new exit codes
Summary: freebsd-update: Add upgradesready and showconfig commands, new exit codes
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Gmelin
URL: https://reviews.freebsd.org/D21473
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-22 19:29 UTC by Michael Gmelin
Modified: 2019-09-26 20:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gmelin freebsd_committer 2019-09-22 19:29:36 UTC
(was originally part of Bug #239997)

While debugging the issue mentioned in Bug #239997, I added a `showconfig' command which I found useful enough to leave it in and document it in the man page.

Like discussed somewhere else, I also added an `updatesready' command that can be used to check if there are any pending fetched updates that can be installed. It exits on status code 2 in case there aren't any pending updates so that if one can tell apart exit 1 (=error) from it (right now there is no code path for that, but if more checks are added in the future this could be useful).

Finally, I changed the exit code of freebsd-update install in case there are no updates pending to be installed and there wasn't a fetch phase to 2 - this should allow future scripts to differentiate between "error" and "nothing to be done" without breaking existing jail managers like ezjail and iocell.

See also:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239997
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240177
Comment 1 commit-hook freebsd_committer 2019-09-24 20:50:20 UTC
A commit references this bug:

Author: grembo
Date: Tue Sep 24 20:49:33 UTC 2019
New revision: 352662
URL: https://svnweb.freebsd.org/changeset/base/352662

Log:
  freebsd-update: Add `updatesready' and `showconfig' commands

  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.

  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.

  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.

  See freebsd-update(8) for details.

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), sectam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
  head/usr.sbin/freebsd-update/freebsd-update.8
  head/usr.sbin/freebsd-update/freebsd-update.sh
Comment 2 commit-hook freebsd_committer 2019-09-26 16:33:30 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 26 16:33:21 UTC 2019
New revision: 352758
URL: https://svnweb.freebsd.org/changeset/base/352758

Log:
  MFC r352513, r352514, r352662:

  As suggested by koobs, MFC recent freebsd-update changes to
  have a consistent user experience on all supported
  versions.

  r352513:
  freebsd-update.8: appease igor

  igor follows American style guides in the belief that abbreviations i.e.
  and e.g. are always followed by a comma.  Make that change now so that
  future updates to freebsd-update.8 do not complain about this.

  r352514:
  freebsd-update: make usage output consistent

  Drop trailing . which appeared only on description of IDS.

  r352662:
  freebsd-update: Add `updatesready' and `showconfig' commands

  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.

  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.

  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), secteam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
  stable/11/usr.sbin/freebsd-update/freebsd-update.8
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Comment 3 commit-hook freebsd_committer 2019-09-26 16:35:35 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 26 16:34:43 UTC 2019
New revision: 352759
URL: https://svnweb.freebsd.org/changeset/base/352759

Log:
  MFC r352513, r352514, r352662:

  As suggested by koobs, MFC recent freebsd-update changes to
  have a consistent user experience on all supported
  versions.

  r352513:
  freebsd-update.8: appease igor

  igor follows American style guides in the belief that abbreviations i.e.
  and e.g. are always followed by a comma.  Make that change now so that
  future updates to freebsd-update.8 do not complain about this.

  r352514:
  freebsd-update: make usage output consistent

  Drop trailing . which appeared only on description of IDS.

  r352662:
  freebsd-update: Add `updatesready' and `showconfig' commands

  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.

  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.

  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), secteam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
  stable/12/usr.sbin/freebsd-update/freebsd-update.8
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Comment 4 commit-hook freebsd_committer 2019-09-26 20:56:15 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 26 20:56:08 UTC 2019
New revision: 352774
URL: https://svnweb.freebsd.org/changeset/base/352774

Log:
  MF stable/12 r352759,r352771

  Approved by:	re (gjb)

  r352759:
  freebsd-update.8: Style fixes, document new features.
  freebsd-update:   Make usage output consistent.
  freebsd-update:   Add `updatesready' and `showconfig' commands
  freebsd-update:   Change exit code of `freebsd-update install' to 2
                    in case there are no pending updates and there wasn't
                    a fetch phase in the same invocation.

  r352771:
  Add mergeinfo missing in r352759

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), secteam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
_U  releng/12.1/
  releng/12.1/usr.sbin/freebsd-update/freebsd-update.8
  releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh