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). I suppose the main existing things that are likely to care about the exit codes are automation tools. Not sure if Ansible cared about the code at all or just reads the output, I can try to figure that out in the week. No idea about others.