Okay to exit after triggers before auto generated #DEBHELPER# code?
Hi!
Is it sane / policy conform to `exit` after triggers, before the auto
generated #DEBHELPER# code had a chance to be executed?
For my question to hopefully become more clear, please have a look at
the following pseudo code of a postinst script.
##########
#!/bin/bash
set -e
case "${1}" in
## ...
triggered)
for trigger in ${2}; do
case "${trigger}" in
...)
## ...
;;
*)
echo "postinst called with unknown trigger \`${2}'" >&2
exit 1
;;
esac
done
## The exit in question... Is the following 'exit 0' okay?
exit 0
;;
*)
echo "postinst called with unknown argument \`${1}'" >&2
exit 1
;;
esac
#DEBHELPER#
##########
The `exit 0` in question would prevent any auto generated `#DEBHELPER#`
code from being run. Does this sound alright?
Or alternatively, I could also ask the other way around:
Are there any cases where Debian maintainer scripts are called with the
'triggered' parameter, where auto generated `#DEBHELPER#` code is
supposed to be executed?
Trivia: Why do you consider to `exit` after triggers without running
auto generated `#DEBHELPER#` code? For performance reasons. When the
auto generated `#DEBHELPER#` code contains systemd restart actions and
triggers run often, this takes quite a while longer.
Cheers,
Patrick
Reply to: