blob: 22d2b5b770b243a59b3d88f833e1d36644bbd78d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#!/bin/sh
# config script for phpbb3
# Copyright 2004 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
# Copyright 2010 J.M. Roth <jmroth@iip.lu>
#
# 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=$(</dev/urandom tr -dc A-NP-Za-km-z0-9 | head -c 10)
db_subst phpbb3/admin-pass-generated genpass $P1
db_input high phpbb3/admin-pass-generated || true
db_go || true
db_set phpbb3/admin-pass $P1
dc_forget phpbb3/admin-pass-generated
fi
OK=true
done
fi
dc_forget phpbb3/admin-pass-ask
fi
fi
|