diff options
| author | Cassio de Campos <cassiopc@gmail.com> | 2018-08-24 19:23:11 +0000 |
|---|---|---|
| committer | Cassio de Campos <cassiopc@gmail.com> | 2018-08-24 19:23:11 +0000 |
| commit | 27256ca804e34366f2413222be4e675fe63a4af9 (patch) | |
| tree | ab6adbbd100e3d58c6af646fea0d026129ebfb04 /debian/boca-common.postinst | |
| parent | c8994053b1ff9ccf47b532be6567c0f7f33f5f3c (diff) | |
| parent | 9f05ae47d104864162f264fe6415d73797e039bd (diff) | |
| download | boca-27256ca804e34366f2413222be4e675fe63a4af9.tar.gz boca-27256ca804e34366f2413222be4e675fe63a4af9.zip | |
Merge branch 'devel' into develc
Diffstat (limited to 'debian/boca-common.postinst')
| -rw-r--r-- | debian/boca-common.postinst | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/boca-common.postinst b/debian/boca-common.postinst new file mode 100644 index 0000000..d28de8a --- /dev/null +++ b/debian/boca-common.postinst @@ -0,0 +1,50 @@ +#!/bin/bash + +set -e + +. /usr/share/debconf/confmodule + +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 + + 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 |