gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: debian package fixes


From: gnunet
Subject: [taler-merchant] branch master updated: debian package fixes
Date: Sat, 02 Jan 2021 14:05:34 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 2b36cd1d debian package fixes
2b36cd1d is described below

commit 2b36cd1d866ca080e0f4e026f0445fe1577b07cc
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jan 2 14:05:31 2021 +0100

    debian package fixes
---
 debian/control                 |  6 ++--
 debian/db/install/pgsql        | 73 +++++++++++++++++++++++++++++++++++++++++-
 debian/db/upgrade/pgsql        |  2 --
 debian/taler-merchant.config   | 18 +++++++++++
 debian/taler-merchant.install  |  3 +-
 debian/taler-merchant.postinst | 51 ++++++++---------------------
 6 files changed, 107 insertions(+), 46 deletions(-)

diff --git a/debian/control b/debian/control
index 93f290d9..cc6d8595 100644
--- a/debian/control
+++ b/debian/control
@@ -38,7 +38,7 @@ Architecture: any
 Pre-Depends:
  ${misc:Pre-Depends}
 Depends:
- libtalerexchange (= ${binary:Version}),
+ libtalerexchange (>= 0.9.0),
  adduser,
  lsb-base,
  netbase,
@@ -53,8 +53,8 @@ Package: libtalermerchant-dev
 Section: libdevel
 Architecture: any
 Depends:
- libtalerexchange-dev (= ${binary:Version}),
- libgnunet-dev (>=1:0.14.0),
+ libtalerexchange-dev (>= 0.9.0),
+ libgnunet-dev (>=0.14.0),
  ${misc:Depends}
 Description: libraries to talk to a GNU Taler merchant (development)
  .
diff --git a/debian/db/install/pgsql b/debian/db/install/pgsql
old mode 100644
new mode 100755
index f15429b0..8173aeff
--- a/debian/db/install/pgsql
+++ b/debian/db/install/pgsql
@@ -1,2 +1,73 @@
 #!/bin/sh
-taler-merchant-dbinit -c /etc/taler-merchant.conf
+
+set -eu
+
+# get database settings from dbconfig-common and configure
+# for ADMINISTRATIVE access
+if [ -f /etc/dbconfig-common/taler-merchant.conf ]; then
+    . /etc/dbconfig-common/taler-merchant.conf
+    case "$dbc_dbtype" in
+        pgsql)
+            taler-config -w \
+                         -c /etc/taler-merchant.conf \
+                         -s "merchantdb-postgres" \
+                         -o "CONFIG" \
+                         -V "postgres:///$dbc_dbname"
+            taler-config -w \
+                         -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
+
+# Run database initialization logic
+sudo -u postgres taler-merchant-dbinit -c /etc/taler-merchant.conf
+
+
+# get database settings from dbconfig-common and configure
+# for service access!
+if [ -f /etc/dbconfig-common/taler-merchant.conf ]; then
+    . /etc/dbconfig-common/taler-merchant.conf
+    case "$dbc_dbtype" in
+        pgsql)
+            taler-config -w \
+                         -c /etc/taler-merchant.conf \
+                         -s "merchantdb-postgres" \
+                         -o "CONFIG" \
+                         -V 
"postgres://$dbc_dbuser:$dbc_dbpass@$dbc_dbserver/$dbc_dbname"
+            taler-config -w \
+                         -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
diff --git a/debian/db/upgrade/pgsql b/debian/db/upgrade/pgsql
deleted file mode 100644
index f15429b0..00000000
--- a/debian/db/upgrade/pgsql
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-taler-merchant-dbinit -c /etc/taler-merchant.conf
diff --git a/debian/taler-merchant.config b/debian/taler-merchant.config
index 1e56b1e5..6eac093d 100644
--- a/debian/taler-merchant.config
+++ b/debian/taler-merchant.config
@@ -10,6 +10,24 @@ db_go
 db_input low taler-merchant/groupname || true
 db_go
 
+# Set permissions for sqlite3 file
+# (for when we support sqlite3 in the future)
+dbc_dbfile_owner="${_USERNAME}:${_GROUPNAME}"
+dbc_dbfile_perms="0600"
+
+dbc_psql_createdb_encoding="UTF8"
+
+# Set MySQL encoding to UTF8, just in case MySQL
+# support is added in the future.
+dbc_mysql_createdb_encoding="UTF8"
+
+# Try to get it to use UNIX domain sockets, if possible.
+# (Note: doesn't seem to do much, still uses username+PW+TCP
+#  on my system :-(  dbconfig documentation sucks.).
+dbc_authmethod_user=ident
+dbc_authmethod_admin=ident
+
+
 
 if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
     . /usr/share/dbconfig-common/dpkg/config.pgsql
diff --git a/debian/taler-merchant.install b/debian/taler-merchant.install
index ee7d8edb..77e2900b 100644
--- a/debian/taler-merchant.install
+++ b/debian/taler-merchant.install
@@ -1,6 +1,5 @@
 usr/bin/
 usr/lib/*/taler/*.so
-debian/conf/* etc/taler-merchant/
 debian/etc/* /etc/
+debian/conf/* etc/taler-merchant/
 debian/db/install/* usr/share/dbconfig-common/scripts/taler-merchant/install/
-debian/db/upgrade/* usr/share/dbconfig-common/scripts/taler-merchant/upgrade/
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"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]