diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-01-02 14:05:31 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-01-02 14:05:31 +0100 |
commit | 2b36cd1d866ca080e0f4e026f0445fe1577b07cc (patch) | |
tree | 5ebc4dafa6a62fe3e759f3b6c1acd3113e8b2e2b /debian | |
parent | a0a8f482fb69d6fc79e13f3fba302fc7ff964a3f (diff) | |
download | merchant-2b36cd1d866ca080e0f4e026f0445fe1577b07cc.tar.gz merchant-2b36cd1d866ca080e0f4e026f0445fe1577b07cc.tar.bz2 merchant-2b36cd1d866ca080e0f4e026f0445fe1577b07cc.zip |
debian package fixes
Diffstat (limited to 'debian')
-rw-r--r-- | debian/control | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | debian/db/install/pgsql | 73 | ||||
-rw-r--r-- | debian/db/upgrade/pgsql | 2 | ||||
-rw-r--r-- | debian/taler-merchant.config | 18 | ||||
-rw-r--r-- | debian/taler-merchant.install | 3 | ||||
-rw-r--r-- | 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 index f15429b0..8173aeff 100644..100755 --- 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" |