aboutsummaryrefslogtreecommitdiff
path: root/debian/taler-auditor.postinst
blob: e624c6df36c34825074c95b405e0ff1858cfadbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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

function mark_secret() {
  if ! dpkg-statoverride --list "$1" >/dev/null 2>&1; then
    dpkg-statoverride --add --update ${_USERNAME} ${_GROUPNAME} 640 "$1"
  fi
}

case "${1}" in
configure)
  # Creating taler groups as needed
  if ! getent group ${_GROUPNAME} >/dev/null; then
    addgroup --quiet --system ${_GROUPNAME}
  fi
  # Creating taler users if needed
  if ! getent passwd ${_USERNAME} >/dev/null; then
    adduser --quiet --system --ingroup ${_GROUPNAME} --no-create-home --home ${TALER_HOME} ${_USERNAME}
  fi

  mark_secret /etc/taler-auditor/secrets/auditor-db.secret.conf
  mark_secret /etc/taler-exchange/secrets/exchange-accountcredentials-1.secret.conf

  ;;

abort-upgrade | abort-remove | abort-deconfigure) ;;
*)
  echo "postinst called with unknown argument \`${1}'" >&2
  exit 1
  ;;
esac

#DEBHELPER#

exit 0