From 9afc0704ec837e6b3ef584ce0e66528b8a2cfa10 Mon Sep 17 00:00:00 2001 From: Bruno Cesar Ribas Date: Thu, 23 Aug 2018 11:31:42 -0300 Subject: d/boca-common.{postinst,templates}: Adds new postinst This version will prompt user for a DB hostname and password Signed-off-by: Bruno Cesar Ribas --- debian/boca-common.postinst | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 debian/boca-common.postinst (limited to 'debian/boca-common.postinst') diff --git a/debian/boca-common.postinst b/debian/boca-common.postinst new file mode 100644 index 0000000..f6c61cd --- /dev/null +++ b/debian/boca-common.postinst @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e + +. /usr/share/debconf/confmodule + +priority=high + +case "$1" in + configure|reconfigure) + db_input high boca-common/dbhost || true + db_go || true + + db_get boca-common/dbhost || true + DBHOST="$RET" + + if [[ "x$DBHOST" == "x" ]]; then + DBHOST=localhost + fi + + db_input high boca-common/dbpassword || true + db_go || true + + db_get boca-common/dbpassword || true + PASSWORD="$RET" + + if [[ "x$PASSWORD" == "x" ]]; then + printf "Generating password with makepasswd" + PASSWORD="$(makepasswd --chars 20)" + echo . + fi + export PASSWD="$PASSWORD" + boca-config-dbhost $DBHOST + unset PASSWD + ;; + *) + ;; +esac + +chmod 600 /var/www/boca/src/private/conf.php +chown www-data.www-data /var/www/boca/src/private/conf.php + +exit 0 -- cgit v1.2.3 From 9f05ae47d104864162f264fe6415d73797e039bd Mon Sep 17 00:00:00 2001 From: Bruno Cesar Ribas Date: Thu, 23 Aug 2018 23:25:23 -0300 Subject: d/boca-{common,db}.postinst: Avoid asking same question on upgrade From now on the user must remove lines containing 'bdserver' or 'bdcreated in /etc/boca.conf in order to modify the DB password and the DB hostname. Signed-off-by: Bruno Cesar Ribas --- debian/boca-common.postinst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'debian/boca-common.postinst') diff --git a/debian/boca-common.postinst b/debian/boca-common.postinst index f6c61cd..d28de8a 100644 --- a/debian/boca-common.postinst +++ b/debian/boca-common.postinst @@ -8,6 +8,13 @@ priority=high case "$1" in configure|reconfigure) + if [[ -e "/etc/boca.conf" ]]; then + . /etc/boca.conf + if [[ "$bdserver" != "" ]]; then + echo "If you want to reset DB configuration, please unset \"bdserver\" in /etc/boca.conf" + exit 0 + fi + fi db_input high boca-common/dbhost || true db_go || true -- cgit v1.2.3