#!/bin/sh # config script for phpbb3 # Copyright 2004 Jeroen van Wolffelaar # Copyright 2010 J.M. Roth # # possible calls: called from postinst, same calls + reconfigure set -e if [ "$PB3DEBUG" = "maint" ]; then echo "[maint] $0 $@" >&2 fi if [ "$PB3DEBUG" = "sh" ]; then set -x fi SUPPORTED_WEBSERVERS="apache2 lighttpd" . /usr/share/debconf/confmodule db_version 2.0 # create the list of what webservers we should show in debconf # (if the dialog is displayed at all) AVAILABLE_WEBSERVERS="" for w in $SUPPORTED_WEBSERVERS; do if [ -x /usr/sbin/$w ]; then AVAILABLE_WEBSERVERS="${AVAILABLE_WEBSERVERS:+$AVAILABLE_WEBSERVERS, }$w" fi done # remember previously configured webservers for postinst # (where we determine which webservers to actually restart) db_register phpbb3/httpd phpbb3/httpd-old db_get phpbb3/httpd db_set phpbb3/httpd-old "$RET" db_subst phpbb3/httpd choices $AVAILABLE_WEBSERVERS db_input high phpbb3/httpd || true db_go || true # some files of the package need to be present to configure the package if [ -f /usr/share/phpbb3/maint-libs/webapps-config ] && \ [ -f /usr/share/phpbb3/maint-libs/dbapps-lib ]; then . /usr/share/phpbb3/maint-libs/webapps-config . /usr/share/phpbb3/maint-libs/dbapps-lib dc_dbg if [ -f /usr/share/dbconfig-common/dpkg/config ]; then dbc_dbtypes="mysql, pgsql, sqlite" . /usr/share/dbconfig-common/dpkg/config if ! dbc_go phpbb3 $@; then echo 'dbc_go (config) failed' fi fi dc_dbg # ask to provide board's admin password # - if dbconfig-common is used at all, and # - this is a fresh install (or reconfigure), or # - the password has never been changed from 'admin' if dc_true phpbb3/dbconfig-install ; then if [ -n "$2" ] && ! dc_true phpbb3/dbconfig-remove ; then check_admin_passwd=$(run_sql "SELECT user_password FROM phpbb_users WHERE username='admin';") fi # first ask whether we should ask the questions at all (admin-pass-ask): # otherwise, when e.g. reconfiguring the _webserver_ one would # also have to set a new password (NO, in contrary to standard # dbconfig-common behavior, an empty password here does not mean # "use the old password" but "generate random password" case "$1" in configure ) case "$2" in # package install "" ) db_set phpbb3/admin-pass-ask true ;; # package upgrade/reinstall * ) if [ "$check_admin_passwd" = "$(_md5 admin)" ] || dc_true phpbb3/dbconfig-reinstall ; then db_set phpbb3/admin-pass-ask true fi ;; esac ;; # dpkg-reconfigure reconfigure ) # database reinstall if dc_true phpbb3/dbconfig-reinstall ; then db_set phpbb3/admin-pass-ask true else db_input high phpbb3/admin-pass-ask || true db_go || true fi ;; * ) db_set phpbb3/admin-pass-ask false ;; esac if dc_true phpbb3/admin-pass-ask ; then OK=false until [ "$OK" = "true" ] ; do dc_forget phpbb3/admin-pass db_input high phpbb3/admin-pass || true db_go || true P1=$(dc_get phpbb3/admin-pass) if [ -n "$P1" ] ; then if [ "${#P1}" -lt 6 ] ; then db_input high phpbb3/admin-pass-requirements && db_go || true dc_forget phpbb3/admin-pass dc_forget phpbb3/admin-pass-confirm continue fi db_input high phpbb3/admin-pass-confirm || true db_go || true P2=$(dc_get phpbb3/admin-pass-confirm) if [ "$P1" != "$P2" ] ; then db_input high phpbb3/admin-pass-mismatch || true db_go || true dc_forget phpbb3/admin-pass dc_forget phpbb3/admin-pass-confirm continue fi else P2= P1=$(