From f0cc7e805cd32edd8cecf7a6ffeb9d001ccbda79 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Aug 2023 22:12:26 +0200 Subject: remove dbconfig support from Debian package as per DD40 --- debian/control | 1 - debian/db/install/pgsql | 38 -------------------------------------- debian/taler-merchant.config | 23 ----------------------- debian/taler-merchant.install | 2 -- debian/taler-merchant.postinst | 13 ------------- debian/taler-merchant.postrm | 30 ------------------------------ debian/taler-merchant.preinst | 29 ----------------------------- debian/taler-merchant.prerm | 12 ------------ 8 files changed, 148 deletions(-) delete mode 100755 debian/db/install/pgsql delete mode 100644 debian/taler-merchant.config delete mode 100644 debian/taler-merchant.postrm delete mode 100644 debian/taler-merchant.preinst diff --git a/debian/control b/debian/control index f0416127..123d979b 100644 --- a/debian/control +++ b/debian/control @@ -53,7 +53,6 @@ Depends: netbase, sudo, apache2 | nginx | httpd, - dbconfig-pgsql | dbconfig-no-thanks, ${misc:Depends}, ${shlibs:Depends} Recommends: diff --git a/debian/db/install/pgsql b/debian/db/install/pgsql deleted file mode 100755 index 852390df..00000000 --- a/debian/db/install/pgsql +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -eu - -merchantdb_secretconf=/etc/taler/secrets/merchant-db.secret.conf -merchantdb_overrideconf=/etc/taler/merchant-overrides.conf - -# Get database settings from dbconfig-common and write Taler configuration files. -if [ -f /etc/dbconfig-common/taler-merchant.conf ]; then - . /etc/dbconfig-common/taler-merchant.conf - case "$dbc_dbtype" in - pgsql) - echo -e "# Config file auto-generated by Debian.\n[merchant]\nDB=postgres\n\n" > \ - $merchantdb_overrideconf - # We assume ident auth here. We might support password auth later. - echo -e "[merchantdb-postgres]\nCONFIG=postgres:///${dbc_dbname}\n\n" > \ - $merchantdb_secretconf - - # Allow the taler-merchant-httpd user to create schemas, needed by dbinit - echo -e "GRANT CREATE ON DATABASE \"${dbc_dbname}\" TO \"taler-merchant-httpd\";\n" | sudo -u postgres psql -f - - # Run database initialization logic - sudo -u taler-merchant-httpd taler-merchant-dbinit -c /etc/taler/taler.conf - ;; - 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/taler-merchant.config b/debian/taler-merchant.config deleted file mode 100644 index da0b34b2..00000000 --- a/debian/taler-merchant.config +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -set -e - -. /usr/share/debconf/confmodule - -_USERNAME=taler-merchant-httpd -_GROUPNAME=www-data - -# For now, we only support postgres -dbc_dbtypes=pgsql -dbc_dbuser=${_USERNAME} -dbc_first_version="0.9.0" - -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 - dbc_go taler-merchant "$@" -fi - -db_stop diff --git a/debian/taler-merchant.install b/debian/taler-merchant.install index 3ae878a2..b1d93b17 100644 --- a/debian/taler-merchant.install +++ b/debian/taler-merchant.install @@ -9,5 +9,3 @@ usr/share/man/man1/* debian/etc/* /etc/ -# Files needed by dbconf -debian/db/install/* usr/share/dbconfig-common/scripts/taler-merchant/install/ diff --git a/debian/taler-merchant.postinst b/debian/taler-merchant.postinst index 2ccd679b..73c272bb 100644 --- a/debian/taler-merchant.postinst +++ b/debian/taler-merchant.postinst @@ -22,12 +22,6 @@ TALER_HOME="/var/lib/taler" _USERNAME=taler-merchant-httpd _GROUPNAME=www-data -# Set permissions for sqlite3 file -# (for when we support sqlite3 in the future) -dbc_dbfile_owner="${_USERNAME}:${_GROUPNAME}" -dbc_dbfile_perms="0600" -dbc_first_version="0.9.0" - . /usr/share/debconf/confmodule case "${1}" in @@ -44,13 +38,6 @@ configure) /etc/taler/secrets/merchant-db.secret.conf fi - # Set up 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 - ;; abort-upgrade | abort-remove | abort-deconfigure) ;; diff --git a/debian/taler-merchant.postrm b/debian/taler-merchant.postrm deleted file mode 100644 index 716f8982..00000000 --- a/debian/taler-merchant.postrm +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -set -e - -if [ -f /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule -fi - -if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then - . /usr/share/dbconfig-common/dpkg/postrm.pgsql - dbc_go taler-merchant "$@" -fi - -case "${1}" in -purge) -# TODO: anything to clean up? Like: -# rm -f /etc/taler/merchant-overrides.conf - ;; -remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) - ;; - - *) - echo "postrm called with unknown argument \`${1}'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/taler-merchant.preinst b/debian/taler-merchant.preinst deleted file mode 100644 index dda68f09..00000000 --- a/debian/taler-merchant.preinst +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# We prevent a few questions from being asked -# upon installation by specifying defaults. Namely, -# we want the database to be accessed via Unix domain -# sockets and password-less. - -set -e - -# When purging this package after the selections in the preinst have been made, -# the debconf database is left in an inconsistent state and the package cannot -# be installed again. This happens because dbconf-common will create a -# template for these questions with a shared owner. Purging will only delete -# one of the two templates, leading to a DB state where debconf-set-selections -# fails. We work around this by manually fixing up the debconf database. -# -# Unfortunately we can't do this in "postrm", because during "postrm" -# the configuration database is locked (even after db_stop). -# -# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487300 -if [ -x /usr/share/debconf/fix_db.pl ]; then - /usr/share/debconf/fix_db.pl || true -fi - -echo taler-merchant taler-merchant/pgsql/method select Unix socket | debconf-set-selections -echo taler-merchant taler-merchant/pgsql/authmethod-user select ident | debconf-set-selections -echo taler-merchant taler-merchant/pgsql/app-pass password | debconf-set-selections - -exit 0 diff --git a/debian/taler-merchant.prerm b/debian/taler-merchant.prerm index eccb8259..727964b0 100644 --- a/debian/taler-merchant.prerm +++ b/debian/taler-merchant.prerm @@ -6,16 +6,4 @@ if [ -d /run/systemd/system ] && [ "$1" = remove ]; then deb-systemd-invoke stop 'taler-merchant-httpd.service' >/dev/null || true fi -if [ -f /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule -fi -. /usr/share/dbconfig-common/dpkg/prerm - -if [ -f /usr/share/dbconfig-common/dpkg/prerm.pgsql ]; then - . /usr/share/dbconfig-common/dpkg/prerm.pgsql - dbc_go taler-merchant "$@" -fi - - -db_stop exit 0 -- cgit v1.2.3