From 2b36cd1d866ca080e0f4e026f0445fe1577b07cc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 2 Jan 2021 14:05:31 +0100 Subject: debian package fixes --- debian/taler-merchant.postinst | 51 +++++++++++------------------------------- 1 file changed, 13 insertions(+), 38 deletions(-) (limited to 'debian/taler-merchant.postinst') 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" -- cgit v1.2.3