On Sun, Jul 02, 2023 at 06:06:28PM +0100, Stuart Henderson wrote:
> On 2023/07/02 16:49, Solène Rapenne wrote:
> > On Sun, 2023-07-02 at 15:51 +0200, Marc Espie wrote:
> > > Use-case: some people want to branch automated installs based on
> > > whether
> > > pkg_add -u (or some other variation) actually did something.
> > > 
> > > As usual we ignore quirks. This adds a flag (-DSYSPATCH_LIKE)
> > > which governs the behavior. Code is fairly self-explanatory.
> > > 
> > > I had no better idea for the flag name so far, suggestions welcome.
> > 
> > if I read well, the exit code is 2 when something pkg_add changed
> > something?
> > 
> > syspatch exits with 0 when installing an update, 1 if it fails, 2 if
> > didn't do anything
> > 
> > Could it be possible to keep it consistent? pkg_add upgrading/installing
> > a package should exit with 0, so it doesn't break current scripts, and
> > this is what you would expect.
> 
> I wonder whether there's actually a need to make this optional.
> 0 for "updated successfully", non-zero values for failed or "no updates
> available" makes a lot of sense to me (and makes it easier to check
> the common "did this successfully update some package" case).

Notice that it works on *every* invocation of pkg_add, so no, it has
to be limited.

I frequently use "pkg_add something" to make sure some code has been
installed (or even pkg_add -u something to make sure it's uptodate)
In a script with set -e, having it not return 0 would play havoc.

Reply via email to