5 [ "$1" = "configure" ] || exit 0
6 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
9 . /usr/share/carnet-tools/functions.sh
11 . /usr/share/debconf/confmodule
13 # Fri, 18 Feb 2005 11:48:51 +0100
14 MM_CFG="/etc/mailman/mm_cfg.py"
16 if [ ! -L /usr/lib/mailman/Mailman/mm_cfg.py -a -f /usr/lib/mailman/Mailman/mm_cfg.py ]; then
17 mv /usr/lib/mailman/Mailman/mm_cfg.py /usr/lib/mailman/Mailman/mm_cfg.py.cn-bak
18 ln -sf /etc/mailman/mm_cfg.py /usr/lib/mailman/Mailman/mm_cfg.py
21 if [ ! -L /etc/apache2/conf.d/mailman-cn.conf -a ! -f /etc/apache2/conf.d/mailman-cn.conf ]; then
22 ln -sf /etc/mailman/apache.conf /etc/apache2/conf.d/mailman-cn.conf
25 hostname="`hostname --fqdn`"
30 if ( grep -E -q "^$opt " $MM_CFG && ! grep -E -q "^$opt = $val$" $MM_CFG ) || grep -E -q "^#$opt " $MM_CFG; then
35 \$_ = \"$opt = $val\\n\";
41 " < $MM_CFG > ${MM_CFG}.$$
42 if ! cmp -s $MM_CFG ${MM_CFG}.$$; then
43 cp_mv ${MM_CFG}.$$ $MM_CFG
47 exit 1 # shouldn't happen
49 elif ! grep -E -q "^$opt = $val$" $MM_CFG; then
50 echo "$opt = $val" >> $MM_CFG
55 cp_backup_conffile -p -d mailman $MM_CFG || true
57 # ocisti smece od prosle verzije
58 if dpkg --compare-versions "$2" lt 2:2.1.5-9; then
60 grep -v -E 'DEFAULT_(URL_PATTERN|URL_HOST|EMAIL_HOST) =' $MM_CFG | \
61 awk '/^# Default host for web interface of newly created MLs/ { print $0; print "DEFAULT_EMAIL_HOST = '$HN'"; getline } { print $0 }' | \
62 awk '/^# Default domain for email addresses of newly created MLs/ { print $0; print "DEFAULT_URL_HOST = '$HN'"; getline } { print $0 }' \
64 cp_mv ${MM_CFG}.$$ $MM_CFG
67 # stavi hrvatski kao jezik
68 mmcfg_add "DEFAULT_SERVER_LANGUAGE" "'hr'"
70 # sredi DEFAULT_URL_PATTERN
71 mmcfg_add "DEFAULT_URL_PATTERN" "'http://%s/cgi-bin/mailman/'"
73 # sredi VIRTUAL_HOST_OVERVIEW
74 mmcfg_add "VIRTUAL_HOST_OVERVIEW" "Off"
76 # sredi DEFAULT_URL_HOST
77 mmcfg_add "DEFAULT_URL_HOST" "'$hostname'"
79 # sredi DEFAULT_EMAIL_HOST
80 mmcfg_add "DEFAULT_EMAIL_HOST" "'$hostname'"
82 # sredi PRIVATE_ARCHIVE_URL
83 mmcfg_add "PRIVATE_ARCHIVE_URL" "'/cgi-bin/mailman/private'"
85 # kreirati link za smrsh
86 if [ -d /etc/mail/smrsh/ ]; then
87 ln -sf /var/lib/mailman/mail/mailman /etc/mail/smrsh/mailman
90 # zakomentiraj prastare opcije
91 if [ -f $MM_CFG ]; then
92 cp_check_and_sed '^DEFAULT_MAIL_HOST ' \
93 's/^DEFAULT_MAIL_HOST .*/d' \
95 cp_check_and_sed '^DEFAULT_URL ' \
96 's/^\(DEFAULT_URL .*\)/#\1/g' \
100 # kreirati mailman listu
101 if [ -z "`list_lists | grep -i mailman`" ]; then
102 newlist -q mailman mailman@$hostname `pwgen 8 1` > /dev/null
106 if ! grep -q "mailman.*/var/lib/mailman/mail/mailman" /etc/aliases; then
107 cat >> /etc/aliases <<EOF
108 ## mailman mailing list
109 mailman: "|/var/lib/mailman/mail/mailman post mailman"
110 mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman"
111 mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman"
112 mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman"
113 mailman-join: "|/var/lib/mailman/mail/mailman join mailman"
114 mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman"
115 mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman"
116 mailman-request: "|/var/lib/mailman/mail/mailman request mailman"
117 mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman"
118 mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
120 newaliases > /dev/null
123 withlist mailman > /dev/null 2> /dev/null << EOF
130 # dodati roota na mailman listu:
131 if [ ! "`list_members mailman | wc -l`" -ge 1 ]; then
132 add_members -r - mailman <<EOF
137 # sredi debconf da site bude na hrvatskom
138 db_get mailman/site_languages || true
139 site_languages="$RET"
140 if ! echo $site_languages | grep -q 'hr'; then
141 site_languages="$site_languages, hr"
142 db_set mailman/site_languages "$site_languages" || true
145 db_set mailman/default_server_language "hr" || true
147 site_languages="`echo $site_languages | tr -d ','`"
149 mm_dist=/usr/share/mailman
151 for lang in ${site_languages}; do
152 [ -d "${mm_dist}/${lang}" ] || break
153 echo -n "Installing site language ${lang} " >&2
154 mkdir -p ${mm_etc}/${lang}
155 for file in $(ls ${mm_dist}/${lang}); do
157 langfile=${lang}/${file}
158 ucf --debconf-ok --three-way ${mm_dist}/${langfile} ${mm_etc}/${langfile} 2>/dev/null
159 # Upon install ucf leaves a duplicate in .dpkg-dist (Bug #238730), remove it
160 cmp -s ${mm_etc}/${langfile} ${mm_etc}/${langfile}.dpkg-dist \
161 && rm ${mm_etc}/${langfile}.dpkg-dist
170 if [ "$restart" = "yes" -a -x /etc/init.d/mailman -a -x /usr/sbin/invoke-rc.d ]; then
171 invoke-rc.d mailman stop
172 invoke-rc.d mailman start
176 if [ -x /usr/sbin/invoke-rc.d -a -x /etc/init.d/apache2 ]; then
177 invoke-rc.d apache2 reload
182 if [ ! -f /var/lib/mailman/data/adm.pw ]; then
183 echo "CN: IMPORTANT: Change your site administrator password using the command:"
185 echo "CN: # mmsitepass"
188 echo "CN: Web interface is at http://$hostname/cgi-bin/mailman/admin"