apk add continues to install despite pre-install failure
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, but at that point it already installed the package and it will run all the other install scripts (post-install) as if nothing happened.
Here is output where the dependencies and the test package are installed before the pre-install runs:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz (1/3) Installing readline (8.0.0-r0) (2/3) Installing test_dep (1.0.0-r1) (3/3) Installing test_pkg (126.96.36.199) Executing test_pkg-188.8.131.52.pre-install ERROR: test_pkg-184.108.40.206.pre-install: script exited with error 1 Executing test_pkg-220.127.116.11.post-install Executing busybox-1.30.1-r3.trigger
I also 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 it looks like the pre-install actually executes after the install, and does not abort the installation if it fails