There's a closed pull request on the void-packages repository common/hooks/post-install/04-create-xbps-metadata-scripts.sh: fix return code of failed trigger runs https://github.com/void-linux/void-packages/pull/32120 Description: When a template defines `$triggers`, `xbps-src` writes an `INSTALL` script that will invoke the triggers. If the triggers fail, the test in [ $? -ne 0 ] && exit $? will succeed and `exit` will be invoked. However, at the time `exit` is invoked, `$?` will take the value of *the test* `[ $? -ne 0 ]`, which is always `0` (or else the `&&` will short-circuit and the `exit` will not run). The right thing to do is capture `$?` in a persistent variable, `$ret`, that can be tested and returned to properly forward the failure code through the trigger. **NOTE**: This needs a bit of testing, because I don't yet understand the ramifications for `xbps-install` receiving a non-zero trigger return when all of them have returned `0` thus far.