82 lines
2.7 KiB
Bash
82 lines
2.7 KiB
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
TALER_HOME="/var/lib/taler"
|
|
_GROUPNAME=taler-exchange-secmod
|
|
_DBGROUPNAME=taler-exchange-db
|
|
_EUSERNAME=taler-exchange-httpd
|
|
_CLOSERUSERNAME=taler-exchange-closer
|
|
_CSECUSERNAME=taler-exchange-secmod-cs
|
|
_RSECUSERNAME=taler-exchange-secmod-rsa
|
|
_ESECUSERNAME=taler-exchange-secmod-eddsa
|
|
_AGGRUSERNAME=taler-exchange-aggregator
|
|
_WIREUSERNAME=taler-exchange-wire
|
|
|
|
case "${1}" in
|
|
configure)
|
|
|
|
# Create taler groups as needed
|
|
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
|
|
if ! getent passwd ${_EUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_EUSERNAME}
|
|
adduser --quiet ${_EUSERNAME} ${_DBGROUPNAME}
|
|
adduser --quiet ${_EUSERNAME} ${_GROUPNAME}
|
|
fi
|
|
if ! getent passwd ${_RSECUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_RSECUSERNAME}
|
|
fi
|
|
if ! getent passwd ${_CSECUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_CSECUSERNAME}
|
|
fi
|
|
if ! getent passwd ${_ESECUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_ESECUSERNAME}
|
|
fi
|
|
if ! getent passwd ${_WIREUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --home ${TALER_HOME} ${_WIREUSERNAME}
|
|
adduser --quiet ${_WIREUSERNAME} ${_DBGROUPNAME}
|
|
fi
|
|
if ! getent passwd ${_CLOSERUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --home ${TALER_HOME} ${_CLOSERUSERNAME}
|
|
adduser --quiet ${_CLOSERUSERNAME} ${_DBGROUPNAME}
|
|
fi
|
|
if ! getent passwd ${_AGGRUSERNAME} >/dev/null; then
|
|
adduser --quiet --system --no-create-home --home ${TALER_HOME} ${_AGGRUSERNAME}
|
|
adduser --quiet ${_AGGRUSERNAME} ${_DBGROUPNAME}
|
|
fi
|
|
|
|
if ! dpkg-statoverride --list /etc/taler/secrets/exchange-accountcredentials-1.secret.conf >/dev/null 2>&1; then
|
|
dpkg-statoverride --add --update \
|
|
${_WIREUSERNAME} root 460 \
|
|
/etc/taler/secrets/exchange-accountcredentials-1.secret.conf
|
|
fi
|
|
|
|
if ! dpkg-statoverride --list /etc/taler/secrets/exchange-db.secret.conf >/dev/null 2>&1; then
|
|
dpkg-statoverride --add --update \
|
|
root ${_DBGROUPNAME} 660 \
|
|
/etc/taler/secrets/exchange-db.secret.conf
|
|
fi
|
|
|
|
;;
|
|
|
|
abort-upgrade | abort-remove | abort-deconfigure) ;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`${1}'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|