exchange/debian/taler-exchange.postinst

75 lines
2.2 KiB
Plaintext
Raw Normal View History

#!/bin/bash
set -e
. /usr/share/debconf/confmodule
2021-07-16 17:31:19 +02:00
TALER_HOME="/var/lib/taler-exchange"
CONFIG_FILE="/etc/default/taler-exchange"
_GROUPNAME=taler-exchange-secmod
_DBGROUPNAME=taler-exchange-db
_EUSERNAME=taler-exchange-httpd
2021-07-27 16:53:02 +02:00
_CLOSERUSERNAME=taler-exchange-closer
_RSECUSERNAME=taler-exchange-secmod-rsa
2021-07-26 19:04:50 +02:00
_ESECUSERNAME=taler-exchange-secmod-eddsa
_AGGRUSERNAME=taler-exchange-aggregator
_WIREUSERNAME=taler-exchange-wire
2021-07-16 17:31:19 +02:00
2021-07-29 13:41:49 +02:00
# usage: fixperm user:group perms file
function fixperm() {
chown "$1" "$3"
chmod "$2" "$3"
}
case "${1}" in
2021-07-16 17:16:38 +02:00
configure)
# Create taler groups as needed
2021-07-16 17:16:38 +02:00
if ! getent group ${_GROUPNAME} >/dev/null; then
addgroup --quiet --system ${_GROUPNAME}
fi
if ! getent group ${_DBGROUPNAME} >/dev/null; then
addgroup --quiet --system ${_DBGROUPNAME}
fi
# Create taler users if needed
2021-07-16 17:16:38 +02:00
if ! getent passwd ${_EUSERNAME} >/dev/null; then
adduser --quiet --system --ingroup ${_GROUPNAME} --home ${TALER_HOME}/httpd ${_EUSERNAME}
2021-07-26 19:04:50 +02:00
adduser --quiet ${_EUSERNAME} ${_DBGROUPNAME}
2021-07-16 17:16:38 +02:00
fi
if ! getent passwd ${_RSECUSERNAME} >/dev/null; then
adduser --quiet --system --ingroup ${_GROUPNAME} --home ${TALER_HOME}/secmod-rsa ${_RSECUSERNAME}
fi
if ! getent passwd ${_ESECUSERNAME} >/dev/null; then
adduser --quiet --system --ingroup ${_GROUPNAME} --home ${TALER_HOME}/secmod-eddsa ${_ESECUSERNAME}
fi
if ! getent passwd ${_WIREUSERNAME} >/dev/null; then
adduser --quiet --system --home ${TALER_HOME}/wire ${_WIREUSERNAME}
adduser --quiet ${_WIREUSERNAME} ${_DBGROUPNAME}
fi
2021-07-27 16:53:02 +02:00
if ! getent passwd ${_CLOSERUSERNAME} >/dev/null; then
adduser --quiet --system --home ${TALER_HOME}/closer ${_CLOSERUSERNAME}
adduser --quiet ${_CLOSERUSERNAME} ${_DBGROUPNAME}
fi
2021-07-16 17:16:38 +02:00
if ! getent passwd ${_AGGRUSERNAME} >/dev/null; then
adduser --quiet --system --home ${TALER_HOME}/aggregator ${_AGGRUSERNAME}
adduser --quiet ${_AGGRUSERNAME} ${_DBGROUPNAME}
fi
2021-07-29 13:41:49 +02:00
fixperm ${_WIREUSERNAME}:root 460 /etc/taler/secrets/exchange-accounts.secret.conf
fixperm root:${_DBGROUPNAME} 640 /etc/taler/secrets/exchange-db.secret.conf
2021-01-02 14:05:45 +01:00
2021-07-16 17:16:38 +02:00
;;
2021-07-16 17:16:38 +02:00
abort-upgrade | abort-remove | abort-deconfigure) ;;
2021-07-16 17:16:38 +02:00
*)
echo "postinst called with unknown argument \`${1}'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0