summaryrefslogtreecommitdiff
path: root/debian/taler-merchant.postinst
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-02 14:05:31 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-02 14:05:31 +0100
commit2b36cd1d866ca080e0f4e026f0445fe1577b07cc (patch)
tree5ebc4dafa6a62fe3e759f3b6c1acd3113e8b2e2b /debian/taler-merchant.postinst
parenta0a8f482fb69d6fc79e13f3fba302fc7ff964a3f (diff)
downloadmerchant-2b36cd1d866ca080e0f4e026f0445fe1577b07cc.tar.gz
merchant-2b36cd1d866ca080e0f4e026f0445fe1577b07cc.tar.bz2
merchant-2b36cd1d866ca080e0f4e026f0445fe1577b07cc.zip
debian package fixes
Diffstat (limited to 'debian/taler-merchant.postinst')
-rw-r--r--debian/taler-merchant.postinst51
1 files changed, 13 insertions, 38 deletions
diff --git a/debian/taler-merchant.postinst b/debian/taler-merchant.postinst
index baa291f6..dfd3e3de 100644
--- a/debian/taler-merchant.postinst
+++ b/debian/taler-merchant.postinst
@@ -45,6 +45,7 @@ case "${1}" in
_GROUPNAME="${RET:-www-data}"
# Read default values
+ CONFIG_FILE="/etc/default/taler-merchant"
TALER_HOME="/var/lib/taler-merchant"
# Creating taler group if needed
@@ -62,6 +63,18 @@ case "${1}" in
echo " done."
fi
+
+ # Setup postgres database (needs dbconfig-pgsql package)
+ if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
+ . /usr/share/dbconfig-common/dpkg/postinst.pgsql
+ dbc_pgsql_createdb_encoding="UTF8"
+ dbc_go taler-merchant "$@"
+ fi
+
+ chown ${_USERNAME}:postgres /etc/taler-merchant.conf
+ chmod 460 /etc/taler-merchant.conf
+
+
# Create access secret
SECRET=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1`
echo SECRET > ${TALER_HOME}/master-api-key.txt
@@ -99,44 +112,6 @@ EOF
cp -f "${CONFIG_NEW}" "${CONFIG_FILE}"
echo " done."
- # Setup postgres database (needs dbconfig-pgsql package)
- if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
- . /usr/share/dbconfig-common/dpkg/postinst.pgsql
- dbc_pgsql_createdb_encoding="UTF8"
- dbc_go taler-merchant "$@"
- fi
-
- # get database settings from dbconfig-common
- if [ -f /etc/dbconfig-common/taler-merchant.conf ]; then
- . /etc/dbconfig-common/taler-merchant.conf
- case "$dbc_dbtype" in
- pgsql)
- taler-config -c /etc/taler-merchant.conf \
- -s "merchantdb-postgres" \
- -o "CONFIG" \
- -V "postgres://$dbc_dbuser:$dbc_dbpass@$dbc_dbserver/$dbc_dbname"
- taler-config -c /etc/taler-merchant.conf \
- -s "merchant" \
- -o "DB" \
- -V "postgres"
- ;;
- sqlite3)
- # Later: use something like:
- # sqlite:///$DATA_DIR/merchant.db
- # But for now, sqlite is unsupported:
- echo "Unsupported database type $dbc_type."
- exit 1
- ;;
- "")
- ;;
- *)
- echo "Unsupported database type $dbc_type."
- exit 1
- ;;
- esac
- fi
-
-
# Configure Webserver
db_get taler-merchant/reconfigure-webserver
webservers="$RET"