aboutsummaryrefslogtreecommitdiff
path: root/debian/taler-exchange-offline.postinst
blob: 94f729f6619d8bc49c80c4aaa08724d8db168e2e (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
44
45
46
47
#!/bin/bash

set -e

. /usr/share/debconf/confmodule

TALER_HOME="/var/lib/taler-exchange"

# usage: lncfg user home target
function lncfg() {
  local cf=$TALER_HOME/$2/.config
  if [ ! -e $cf ]; then
    mkdir $cf
    chown $(stat -L -c %u $TALER_HOME/$2):$(stat -L -c %g $TALER_HOME/$2) $cf
  fi
  ln -sf $3 $cf/taler.conf
}

case "${1}" in
configure)

  if ! getent group taler-exchange-offline >/dev/null; then
    addgroup --quiet --system taler-exchange-offline
  fi

  if ! getent passwd taler-exchange-offline >/dev/null; then
    adduser --quiet --system \
      --ingroup taler-exchange-offline \
      --home ${TALER_HOME}/offline taler-exchange-offline
  fi

  lncfg taler-exchange-offline taler-exchange-offline /etc/taler/exchange-offline.conf

  echo "All done."
  ;;

abort-upgrade | abort-remove | abort-deconfigure) ;;

*)
  echo "postinst called with unknown argument \`${1}'" >&2
  exit 1
  ;;
esac

#DEBHELPER#

exit 0