| 1 | #!/bin/sh |
| 2 | # postinst script for dmarcts-report-parser |
| 3 | # |
| 4 | # see: dh_installdeb(1) |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | # summary of how this script can be called: |
| 9 | # * <postinst> `configure' <most-recently-configured-version> |
| 10 | # * <old-postinst> `abort-upgrade' <new version> |
| 11 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
| 12 | # <new-version> |
| 13 | # * <postinst> `abort-remove' |
| 14 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
| 15 | # <failed-install-package> <version> `removing' |
| 16 | # <conflicting-package> <version> |
| 17 | # for details, see https://www.debian.org/doc/debian-policy/ or |
| 18 | # the debian-policy package |
| 19 | |
| 20 | case "${1}" in |
| 21 | 'configure') |
| 22 | # setup dmarcts-report-parser system user account |
| 23 | if ! getent 'passwd' '_dmarcts' >'/dev/null'; then |
| 24 | echo 'Creating _dmarcts system user.' >&2 |
| 25 | # if adduser >= 3.122; then use --allow-bad-names |
| 26 | # if not; then use --force-badname |
| 27 | badname_option="--allow-bad-names" |
| 28 | version=`dpkg-query --show --showformat='${Version}' adduser` |
| 29 | if dpkg --compare-versions "$version" "lt" "3.122"; then |
| 30 | badname_option="--force-badname" |
| 31 | fi |
| 32 | |
| 33 | adduser --system \ |
| 34 | --disabled-password --disabled-login \ |
| 35 | --shell /bin/false --group \ |
| 36 | --home /var/lib/dmarcts \ |
| 37 | "$badname_option" \ |
| 38 | _dmarcts |
| 39 | fi |
| 40 | ;; |
| 41 | 'abort-upgrade'|'abort-remove'|'abort-deconfigure') |
| 42 | ;; |
| 43 | *) |
| 44 | echo "postinst called with unknown argument '${1}'" >&2 |
| 45 | exit 1 |
| 46 | ;; |
| 47 | esac |
| 48 | |
| 49 | #DEBHELPER# |
| 50 | |
| 51 | exit 0 |