The documentation for the Alpine package says the following of the pre-install script:

Note the exit 0 at the end. If the script exits with failure (if the user already exist), the package will not be installed and apk add will exit with failure.

However, this isn't the case for me, when the pre-install script returns 1 apk does print the error pre-install: script exited with error 1, and also continues to install the package as well as run all the other install scripts (post-install) as if nothing happened.

Is there any way for me to actually abort the installation should the pre-install fail?

Upon further investigation I saw this while installing an official package:

(1/1) Installing dnsmasq (2.80-r3)
Executing dnsmasq-2.80-r3.pre-install
Executing busybox-1.30.1-r3.trigger

So the pre-install actually executes after the install (☉_☉)

  • What Alpine version? Could you give more details on the specific package(s) with this issue? Or is it a home-brewed package? – valiano Nov 22 '19 at 8:12
  • 1
    @valiano It's a homebrewed package, that's why I'm trying to figure out how pre-install scripts work. Oh and it's Alpine 3.10 – Maxim Nov 22 '19 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.