D18849, commit rS343152,//This originally contained a change to fix src component detection. bug https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224048
aimed to fix freebsd-update's detection if the src component is installed.This was moved to a separate review now (D21579) to speed up review of the bugfix and allow a separate commit that could be MFCed.//
Unfortunately this fix doesn't workWhile debugging the issue mentioned above, as freebsd-update's option calculation works
differentlyI added a `config` command which I found useful enough to leave it in and document it in the man page.
1. If BaseDir is configured in freebsd-update.conf, COMPONENTS is calculated
first, so BASEDIR isn't set yet when used in config_Components
2. If BaseDir is specified on the command line (-b)Like discussed somewhere else, it's moved to
BASEDIR_saved before parsing the configuration file,I also added an `updatesready` command that can be used to check if there are any pending fetched updates that can be installed. so againIt 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, it's
not available when used in config_Componentsbut if more checks are added in the future this could be useful).
The cleanest fix seemed to add an additional function that's called
after parsing all inputs and check if "src" needs to be removedFinally, 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.
The result of this problem is that the existence of /usr/src/COPYRIGHT
determines if the src components should be updated or not, leading
to not updating it or error messages as it isn't around.Besides documentation changed, This
is a common problem for certain jail setups (I noticed it while
upgrading an iocage jail)I also added a comma in the manpage to pacify igor.
While debugging this issue, I added a `config` 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.
Besides documentation changed, I also added a comma in the manpage to pacify
igor.
Happy to accept naming changes (like, if the reviewers happen to not
not like `updatesready` and `config`). Feel free to correct my English.
See also:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239997
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240177