AlkantarClanX12
| Current Path : /var/lib/dpkg/info/ |
| Current File : /var/lib/dpkg/info/mailman.postinst |
#! /bin/sh -e
#
# postinst script for Debian python packages
# Written 1998 by Gregor Hoffleit <flight@debian.org>.
# Updated 2001 by Tollef Fog Heen <tfheen@debian.org>
# mailman modifications 2004 by Bernd S. Brentrup <bsb@debian.org>
# Other modifications 2004-2007 by other maintainers of the Debian package:
# Lionel Elie Mamane, Thijs Kinkhorst, Riccardo Setti, Matej Vela, Hector Garcia, László Böszörményi, Bernd S. Brentrup, ...
#
# $URL: svn+ssh://svn.debian.org/svn/pkg-mailman/trunk/debian/postinst $
# $Id: postinst 693 2011-10-08 15:30:38Z thijs $
#
. /usr/share/debconf/confmodule
PACKAGE=mailman
DIRLIST="/usr/lib/mailman/Mailman /usr/lib/mailman/bin /usr/lib/mailman/cron /usr/lib/mailman/scripts"
PYLIBDIR="/usr/lib/python`python -c 'import sys; print sys.version[:3]'`"
if [ "$1" = "configure" ]; then
mm_etc=/etc/mailman
mm_dist=/usr/share/mailman
# Install only languages selected by the administrator
# forcing used languages to be always available.
db_get mailman/site_languages
site_languages="$(echo $RET | sed -e 's/, */ /g' | sed -r 's/ \([^\)]*\)//g')"
need_languages="${site_languages}"
db_get mailman/used_languages
db_fset mailman/used_languages seen true
db_fset mailman/used_languages scanned false
for lang in ${used_languages} ; do
if echo " ${site_languages} " | grep -v -q " ${lang} " ; then
need_languages="${need_languages:+${need_languages} }${lang}"
fi
done
if [ "${need_languages}" != "${site_languages}" ]; then
db_set mailman/site_languages "$(echo ${need_languages} | sed -e 's/ */, /g')"
fi
# At present ALL directories in /etc/mailman are language directories
# but this may change in the future, better check.
# Furthermore, the administrator may have have added other directories
for dir in $(find ${mm_etc} -maxdepth 1 -mindepth 1 -type d -printf '%P\n'); do
if [ -f ${mm_dist}/${dir}/options.html ]; then
old_languages="${old_languages} ${dir}"
fi
done
# Remove languages no longer used, but purging modified files
# is a bad thing[TM].
leftover=/etc/mailman/leftover
: >${leftover}
for lang in ${old_languages}; do
if echo " ${site_languages} " | grep -v -q " ${lang} " ; then
printf "Removing unmodified files from ${mm_etc}/${lang} " >&2
# UGLY HACK: Since ucf doesn't support conditional removal
# we access its hashfile directly
md5sums=$(tempfile --prefix=mm_${lang})
grep "^[[:xdigit:]]{32}[[:space:]]\+${mm_etc}/$lang/" /var/lib/ucf/hashfile >${md5sums} || true
# Language files are under ucf control, check md5sums
for file in $(md5sum -c ${md5sums} 2>&1 | sed -n 's/: *OK$//p'); do
ucf --debconf-ok --purge ${file}
rm -f ${file} ${file}.dpkg-dist
printf . >&2
done
# For modified files remove corresponding .dpkg-dist
for file in $(grep "^[[:xdigit:]]{32}[[:space:]]\+${mm_etc}/$lang/" /var/lib/ucf/hashfile | awk '{ print $2 }'); do
rm -f ${file}.dpkg-dist
printf . >&2
done
printf " done.\n" >&2
rmdir ${mm_etc}/${lang} 2>/dev/null \
|| printf "Directory ${mm_etc}/${lang} not empty, not removed.\n" >&2
rm -f ${md5sums}
fi
done
for lang in ${site_languages}; do
printf "Installing site language ${lang} " >&2
mkdir -p ${mm_etc}/${lang}
for file in $(ls ${mm_dist}/${lang}); do
printf . >&2
langfile=${lang}/${file}
ucf --debconf-ok --three-way ${mm_dist}/${langfile} ${mm_etc}/${langfile} 2>/dev/null
done
printf " done.\n" >&2
done
# Done with site language stuff
# Don't forget the qmail specific stuff
ucf --debconf-ok --three-way ${mm_dist}/qmail-to-mailman.py ${mm_etc}/qmail-to-mailman.py 2>/dev/null
# Install postfix-to-mailman.py as well
ucf --debconf-ok --three-way ${mm_dist}/postfix-to-mailman.py ${mm_etc}/postfix-to-mailman.py 2>/dev/null
if [ -e /etc/mailman/mm_cfg.py ]; then
db_get mailman/default_server_language || true
if [ -n "$RET" ]; then
default_server_language="$(echo $RET | sed -r 's/ \([^\)]*\)//g')"
sed -e s/DEFAULT_SERVER_LANGUAGE.*=.*\'..\'/DEFAULT_SERVER_LANGUAGE\ =\ \'${default_server_language}\'/ ${mm_etc}/mm_cfg.py > ${mm_etc}/mm_cfg.py.$$
mv -f ${mm_etc}/mm_cfg.py.$$ ${mm_etc}/mm_cfg.py
fi
fi
fi
db_stop || true
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
if [ -e /etc/mailname ]
then
DOMAIN=$(head -n 1 /etc/mailname)
# fixme - should we look for a dot in the domainname?
else
DOMAIN=localhost.localdomain
fi
if [ ! -e /etc/$PACKAGE/mm_cfg.py ]; then
printf "Configuring $PACKAGE for domain $DOMAIN ...\n"
sed s/thunderchild.aszi.sztaki.hu/$DOMAIN/g /usr/lib/mailman/Mailman/mm_cfg.py.dist \
> /etc/$PACKAGE/mm_cfg.py
fi
if grep -q mm_defaults /etc/mailman/mm_cfg.py; then
printf "Changing mm_defaults to Defaults in /etc/mailman/mm_cfg.py\n"
printf "Fixing host name in /etc/mailman/mm_cfg.py\n"
sed s/mm_defaults/Defaults/ "s/'localhost'/$DOMAIN/g" "s#http://localhost#http://$DOMAIN#g" </etc/mailman/mm_cfg.py >/etc/mailman/mm_cfg.py.new
mv /etc/mailman/mm_cfg.py /etc/mailman/mm_cfg.py.old
mv /etc/mailman/mm_cfg.py.new /etc/mailman/mm_cfg.py
fi
if ! [ -d /var/lock/mailman ]; then
install -d -o root -g list -m 2775 /var/lock/mailman
fi
sg list -c "umask 002; /usr/lib/mailman/bin/update;"
;;
*)
printf "postinst called with unknown argument \`$1'\n" >&2
exit 1
;;
esac
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/mailman" ]; then
update-rc.d mailman defaults >/dev/null
invoke-rc.d mailman start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
pycompile -p mailman /usr/lib/mailman/Mailman -V 2.4-
fi
# End automatically added section