From 21781448ac72918c51756b8806621ad664ba3242 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 11 Aug 2023 00:08:45 +0200 Subject: remove dbconfig --- debian/anastasis-httpd.config | 14 -------------- debian/anastasis-httpd.install | 3 --- debian/anastasis-httpd.postinst | 12 ------------ debian/anastasis-httpd.postrm | 5 ----- debian/anastasis-httpd.preinst | 29 ----------------------------- debian/anastasis-httpd.prerm | 11 ----------- debian/control | 1 - debian/db/install/pgsql | 38 -------------------------------------- 8 files changed, 113 deletions(-) delete mode 100644 debian/anastasis-httpd.preinst delete mode 100755 debian/db/install/pgsql diff --git a/debian/anastasis-httpd.config b/debian/anastasis-httpd.config index 97f57bc..97d5101 100644 --- a/debian/anastasis-httpd.config +++ b/debian/anastasis-httpd.config @@ -6,17 +6,3 @@ set -e _USERNAME=anastasis-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 anastasis-httpd "$@" -fi - -db_stop diff --git a/debian/anastasis-httpd.install b/debian/anastasis-httpd.install index 2de9453..9c2d9db 100644 --- a/debian/anastasis-httpd.install +++ b/debian/anastasis-httpd.install @@ -11,6 +11,3 @@ usr/share/anastasis/* usr/share/anastasis/sql/* usr/share/anastasis/config.d/* debian/etc/* /etc/ - -# Files needed by dbconf -debian/db/install/* usr/share/dbconfig-common/scripts/anastasis-httpd/install/ diff --git a/debian/anastasis-httpd.postinst b/debian/anastasis-httpd.postinst index 428d228..6caf699 100644 --- a/debian/anastasis-httpd.postinst +++ b/debian/anastasis-httpd.postinst @@ -22,11 +22,6 @@ ANASTASIS_HOME="/var/lib/anastasis/" _USERNAME=anastasis-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/anastasis/secrets/anastasis-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 anastasis-httpd "$@" - fi - ;; abort-upgrade | abort-remove | abort-deconfigure) ;; diff --git a/debian/anastasis-httpd.postrm b/debian/anastasis-httpd.postrm index dae3873..3dd76af 100644 --- a/debian/anastasis-httpd.postrm +++ b/debian/anastasis-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 anastasis-httpd "$@" -fi - case "${1}" in purge) rm -rf /var/lib/anastasis/httpd/ diff --git a/debian/anastasis-httpd.preinst b/debian/anastasis-httpd.preinst deleted file mode 100644 index 2d6c261..0000000 --- a/debian/anastasis-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 anastasis-httpd anastasis-httpd/pgsql/method select Unix socket | debconf-set-selections -echo anastasis-httpd anastasis-httpd/pgsql/authmethod-user select ident | debconf-set-selections -echo anastasis-httpd anastasis-httpd/pgsql/app-pass password | debconf-set-selections - -exit 0 diff --git a/debian/anastasis-httpd.prerm b/debian/anastasis-httpd.prerm index c59777c..951f5ac 100644 --- a/debian/anastasis-httpd.prerm +++ b/debian/anastasis-httpd.prerm @@ -6,15 +6,4 @@ if [ -d /run/systemd/system ] && [ "$1" = remove ]; then deb-systemd-invoke stop 'anastasis-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 anastasis-httpd "$@" -fi - -db_stop exit 0 diff --git a/debian/control b/debian/control index 3ebc9fc..976254b 100644 --- a/debian/control +++ b/debian/control @@ -52,7 +52,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 08648db..0000000 --- a/debian/db/install/pgsql +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -eu - -conf_anastasis_db=/etc/anastasis/secrets/anastasis-db.secret.conf -conf_override=/etc/anastasis/override.conf - -# Get database settings from dbconfig-common and write anastasis configuration files. -if [ -f /etc/dbconfig-common/anastasis-httpd.conf ]; then - . /etc/dbconfig-common/anastasis-httpd.conf - case "$dbc_dbtype" in - pgsql) - echo -e "# Config file auto-generated by Debian.\n[anastasis]\nDB=postgres\n\n" > \ - $conf_override - # We assume ident auth here. We might support password auth later. - echo -e "[stasis-postgres]\nCONFIG=postgres:///${dbc_dbname}\n\n" > \ - $conf_anastasis_db - - # Allow the taler-merchant-httpd user to create schemas, needed by dbinit - echo "GRANT CREATE ON DATABASE \"${dbc_dbname}\" TO \"anastasis-httpd\";" | sudo -u postgres psql -f - - # Run database initialization logic - sudo -u anastasis-httpd anastasis-dbinit -c /etc/anastasis/anastasis.conf - ;; - sqlite3) - # Later: use something like: - # sqlite:///$DATA_DIR/anastasis.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 -- cgit v1.2.3