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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
#!/bin/sh
# config script for phpbb2
# Copyright 2004 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
set -e
. /usr/share/debconf/confmodule
db_version 2.0
db_capb backup
# Flow of questions:
#
# prio | detail | dbms | dbsetup | Question(s)
# prio | T C M | M P O | C P N |
# -----+--------+--------+-------- +-----
# High | ASK | | | detail
# Low | - - x | | | manual_warning
# High | - x - | ASK | | dbms
# High | - x - | x x - | ASK | dbsetup
###### | - x - | - - x | | dbnosetup_warning
# Mix | - x - | x x x | x x x | dbinfo
# High | x x - | x x - | x - - | dbrootpasswd
# High | - x - | | | httpd
# Debconf's backup behaviour and seen behaviour makes a state machine almost
# impossible: seen flags are not update until after this script is finished,
# so reinjecting and trusting debconf to have unseen the previous question
# not gonna work -- too bad.
# For now, backing up means starting all over.
if [ -e /etc/phpbb2/config.php ] && [ "$1" = reconfigure ]; then
db_reset phpbb2/redodb || true
db_input high phpbb2/redodb || true
db_go # fail config if cancelling
db_get phpbb2/redodb
if [ "$RET" = true ]; then
mv /etc/phpbb2/config.php /etc/phpbb2/config.php.debconf-backup
fi
fi
STATE=init
while [ "$STATE" != "finish" ]; do
case "$STATE" in
init)
db_input high phpbb2/detail || true
db_go # fail config if cancelling
db_get phpbb2/detail || true
DETAIL="$RET"
case "$RET" in
Custom) STATE=dbms ;;
Manual) db_input low phpbb2/manual_warning || true
if ! db_go; then
STATE=init
else
STATE=finish
fi
;;
Typical)
db_reset phpbb2/dbms
db_reset phpbb2/dbsetup
db_reset phpbb2/dbserver
db_reset phpbb2/dbname
db_reset phpbb2/dbuser
#db_reset phpbb2/dbpass # don't reset, otherwise we forget
db_reset phpbb2/httpd
STATE=dbrootpass
;;
esac
;;
dbms)
if [ -e /etc/phpbb2/config.php ]; then
STATE=httpd
continue
fi
db_input high phpbb2/dbms || true
if ! db_go; then
STATE=init
continue
fi
db_get phpbb2/dbms || true
if [ ! "$RET" = ODBC ]; then
DBMS=MP
STATE=dbsetup
else
DBMS=O
STATE=odbc
fi
;;
odbc)
db_input medium phpbb2/odbc_warning || true
db_go
STATE=dbinfo
;;
dbsetup)
db_input high phpbb2/dbsetup || true
if db_go; then
STATE=dbinfo
else
STATE=init
fi
db_get phpbb2/dbsetup || true
if [ "$RET" = Populate ] || [ "$RET" = None ]; then
DBSETUP=PN
else
DBSETUP=C
fi
;;
dbinfo)
db_input high phpbb2/dbserver || true
db_input high phpbb2/dbname || true
db_input high phpbb2/dbuser || true
db_input medium phpbb2/dbpass || true
if db_go; then
if [ "$DBSETUP" = C ] && [ "$DBMS" = MP ]; then
STATE=dbrootpass
else
STATE=httpd
fi
else
STATE=init
fi
db_get phpbb2/dbpass
if [ -z "$RET" ]; then
db_set phpbb2/dbpass "`makepasswd --chars 12`"
fi
;;
dbrootpass)
# if [ -e /etc/phpbb2/config.php ]; then
# STATE=httpd
# continue
# fi
db_get phpbb2/db_created
if [ "$RET" = "true" ]; then
STATE=httpd
break
fi
db_input high phpbb2/dbrootpass || true
if db_go; then
STATE=httpd
else
STATE=init
fi
;;
httpd)
if [ "$DETAIL" = Typical ]; then
STATE=finish
continue
fi
db_input high phpbb2/httpd || true
if db_go; then
STATE=finish
else
STATE=init
fi
;;
finish)
;;
esac
done
|