]> git.donarmstrong.com Git - roundcube.git/blob - debian/roundcube-core.config
72347da7371b2fe49a8150badc4daf34b378a03e
[roundcube.git] / debian / roundcube-core.config
1 #!/bin/sh
2
3 set -e
4
5 . /usr/share/debconf/confmodule
6
7 db_input medium roundcube/hosts || true
8 db_go || true
9
10 # Retrieve all available languages
11 instd_langs=$(echo /usr/share/roundcube/program/localization/*/messages.inc | \
12     sed 's+[^ ]*/\([^ ]*\)/messages.inc+\1,+g' | sed 's+,$++')
13 db_subst roundcube/language languages $instd_langs
14 # First try to get the current choice in case of preseeding or if the
15 # question has already been asked
16 db_get roundcube/language || true
17 locale="$RET"
18 if [ -n "$locale" -a -d "/usr/share/roundcube/program/localization/$locale" ]; then
19     # We get our answer (db_set should be useless in fact)
20     db_set roundcube/language $locale
21 else 
22     # Either we never answered the question or the locale does not
23     # exist any more. In both cases, we do as if we never seen the
24     # question.
25     db_fset roundcube/language seen false
26     # Try to guess the locale
27     locale=$(echo $LANG | sed 's/[@\.].*//')
28     if [ -d /usr/share/roundcube/program/localization/$locale ]; then
29         db_set roundcube/language $locale
30     else
31         locale=$(echo $locale | sed 's/_.*//')
32         if [ -d /usr/share/roundcube/program/localization/$locale ]; then
33             db_set roundcube/language $locale
34         else
35             db_set roundcube/language en_US
36         fi
37     fi
38 fi
39 # Ask the question
40 db_input medium roundcube/language || true
41 db_go || true
42
43 if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
44         dbc_dbtypes="sqlite, mysql, pgsql"
45         dbc_authmethod_user="password"
46         . /usr/share/dbconfig-common/dpkg/config 
47         dbc_go roundcube $@
48 fi
49
50 db_input medium roundcube/reconfigure-webserver || true
51 db_go || true
52 db_input medium roundcube/restart-webserver || true
53 db_go || true