exchange/debian/taler-auditor.postinst

45 lines
1.1 KiB
Bash

#!/bin/bash
set -e
. /usr/share/debconf/confmodule
CONFIG_FILE="/etc/default/taler-auditor"
TALER_HOME="/var/lib/taler-auditor"
_USERNAME=taler-auditor-httpd
_GROUPNAME=taler-auditor-httpd
case "${1}" in
configure)
# Creating taler groups as needed
if ! getent group ${_GROUPNAME} >/dev/null; then
echo -n "Creating new Taler group ${_GROUPNAME} ..."
addgroup --quiet --system ${_GROUPNAME}
echo " done."
fi
# Creating taler users if needed
if ! getent passwd ${_USERNAME} >/dev/null; then
echo -n "Creating new Taler user ${_USERNAME} ..."
adduser --quiet --system --ingroup ${_GROUPNAME} --home ${TALER_HOME}/httpd ${_USERNAME}
echo " done."
fi
if ! dpkg-statoverride --list /etc/taler/secrets/auditor-db.secret.conf >/dev/null 2>&1; then
dpkg-statoverride --add --update \
${_USERNAME} ${_GROUPNAME} 660 \
/etc/taler/secrets/auditor-db.secret.conf
fi
;;
abort-upgrade | abort-remove | abort-deconfigure) ;;
*)
echo "postinst called with unknown argument \`${1}'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0