From 31e13833fb64cad64920921c6ef12619dc68f753 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Aug 2023 22:17:09 +0200 Subject: remove dbconfig support from Debian package as per DD40 --- debian/control | 1 - debian/db/install/pgsql | 38 -------------------------------------- debian/sync-httpd.config | 22 ---------------------- debian/sync-httpd.install | 2 -- debian/sync-httpd.postinst | 12 ------------ debian/sync-httpd.postrm | 5 ----- debian/sync-httpd.preinst | 29 ----------------------------- debian/sync-httpd.prerm | 11 ----------- 8 files changed, 120 deletions(-) delete mode 100755 debian/db/install/pgsql delete mode 100644 debian/sync-httpd.config delete mode 100644 debian/sync-httpd.preinst diff --git a/debian/control b/debian/control index 2f01fdb..c2599e3 100644 --- a/debian/control +++ b/debian/control @@ -50,7 +50,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 47c2dc7..0000000 --- a/debian/db/install/pgsql +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -eu - -conf_sync_db=/etc/sync/secrets/sync-db.secret.conf -conf_override=/etc/sync/override.conf - -# Get database settings from dbconfig-common and write sync configuration files. -if [ -f /etc/dbconfig-common/sync-httpd.conf ]; then - . /etc/dbconfig-common/sync-httpd.conf - case "$dbc_dbtype" in - pgsql) - echo -e "# Config file auto-generated by Debian.\n[sync]\nDB=postgres\n\n" > \ - $conf_override - # We assume ident auth here. We might support password auth later. - echo -e "# Config file auto-generated by Debian.\n[syncdb-postgres]\nCONFIG=postgres:///${dbc_dbname}\n\n" > \ - $conf_sync_db - - # Allow the taler-merchant-httpd user to create schemas, needed by dbinit - echo "GRANT CREATE ON DATABASE \"${dbc_dbname}\" TO \"sync-httpd\";" | sudo -u postgres psql -f - - # Run database initialization logic - sudo -u sync-httpd sync-dbinit -c /etc/sync/sync.conf - ;; - sqlite3) - # Later: use something like: - # sqlite:///$DATA_DIR/sync.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/sync-httpd.config b/debian/sync-httpd.config deleted file mode 100644 index 36e67d1..0000000 --- a/debian/sync-httpd.config +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -set -e - -. /usr/share/debconf/confmodule - -_USERNAME=sync-httpd -_GROUPNAME=www-data - -# For now, we only support postgres -dbc_dbtypes=pgsql -dbc_dbuser=${_USERNAME} - -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 sync-httpd "$@" -fi - -db_stop diff --git a/debian/sync-httpd.install b/debian/sync-httpd.install index 17e4ce9..9ba7428 100644 --- a/debian/sync-httpd.install +++ b/debian/sync-httpd.install @@ -8,5 +8,3 @@ usr/share/man/man1/sync-httpd.1 debian/etc/* /etc/ -# Files needed by dbconf -debian/db/install/* usr/share/dbconfig-common/scripts/sync-httpd/install/ diff --git a/debian/sync-httpd.postinst b/debian/sync-httpd.postinst index 9eaddab..4c80646 100644 --- a/debian/sync-httpd.postinst +++ b/debian/sync-httpd.postinst @@ -22,11 +22,6 @@ SYNC_HOME="/var/lib/sync/" _USERNAME=sync-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" - . /usr/share/debconf/confmodule case "${1}" in @@ -42,13 +37,6 @@ configure) /etc/sync/secrets/sync-db.secret.conf 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 sync-httpd "$@" - fi - ;; abort-upgrade | abort-remove | abort-deconfigure) ;; diff --git a/debian/sync-httpd.postrm b/debian/sync-httpd.postrm index 79934a8..31cd456 100644 --- a/debian/sync-httpd.postrm +++ b/debian/sync-httpd.postrm @@ -6,11 +6,6 @@ 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 sync-httpd "$@" -fi - case "${1}" in purge) rm -rf /var/lib/sync/httpd/ diff --git a/debian/sync-httpd.preinst b/debian/sync-httpd.preinst deleted file mode 100644 index 9588b73..0000000 --- a/debian/sync-httpd.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 sync-httpd sync-httpd/pgsql/method select Unix socket | debconf-set-selections -echo sync-httpd sync-httpd/pgsql/authmethod-user select ident | debconf-set-selections -echo sync-httpd sync-httpd/pgsql/app-pass password | debconf-set-selections - -exit 0 diff --git a/debian/sync-httpd.prerm b/debian/sync-httpd.prerm index 0c134b2..317d020 100644 --- a/debian/sync-httpd.prerm +++ b/debian/sync-httpd.prerm @@ -6,15 +6,4 @@ if [ -d /run/systemd/system ] && [ "$1" = remove ]; then deb-systemd-invoke stop 'sync-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 sync-httpd "$@" -fi - -db_stop exit 0 -- cgit v1.2.3