aboutsummaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorBruno Cesar Ribas <brunoribas@gmail.com>2018-08-23 14:31:42 +0000
committerBruno Cesar Ribas <brunoribas@gmail.com>2018-08-23 14:31:42 +0000
commit9afc0704ec837e6b3ef584ce0e66528b8a2cfa10 (patch)
treea7c4a56a91dd498e120596a5984ea8f54b6813ba /debian
parent009899084bd9beb7f9a9f94925b60f194e0889a2 (diff)
downloadboca-9afc0704ec837e6b3ef584ce0e66528b8a2cfa10.tar.gz
boca-9afc0704ec837e6b3ef584ce0e66528b8a2cfa10.zip
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 <brunoribas@gmail.com>
Diffstat (limited to 'debian')
-rw-r--r--debian/boca-common.postinst43
-rw-r--r--debian/boca-common.templates10
2 files changed, 53 insertions, 0 deletions
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
diff --git a/debian/boca-common.templates b/debian/boca-common.templates
new file mode 100644
index 0000000..e993675
--- /dev/null
+++ b/debian/boca-common.templates
@@ -0,0 +1,10 @@
+Template: boca-common/dbhost
+Type: string
+Default: localhost
+Description: Please provide a host within BOCA database:
+
+Template: boca-common/dbpassword
+Type: password
+Description: Please provide a password for BOCA database:
+ Please, do not forget this password. You will need it to provide it while
+ configuring boca-web and boca-autojudge.