[Pkg-mailman-hackers] Pkg-mailman commit - rev 99 - branches/pkg-split/core/debian
Bernd S. Brentrup
bsb@haydn.debian.org
Thu, 29 Apr 2004 13:29:38 -0600
Author: bsb
Date: 2004-04-29 13:29:35 -0600 (Thu, 29 Apr 2004)
New Revision: 99
Added:
branches/pkg-split/core/debian/mailman-i18n.config
Log:
Start out with site_languages stuff from old config
for mailman-i18n.config.
Added: branches/pkg-split/core/debian/mailman-i18n.config
===================================================================
--- branches/pkg-split/core/debian/mailman-i18n.config 2004-04-29 19:26:57 UTC (rev 98)
+++ branches/pkg-split/core/debian/mailman-i18n.config 2004-04-29 19:29:35 UTC (rev 99)
@@ -0,0 +1,85 @@
+#! /bin/sh -e
+# $URL$
+# $Id$
+
+. /usr/share/debconf/confmodule
+
+crontab=/etc/cron.d/mailman
+
+get_used_languages ()
+{
+ # Python being non-essential it may not be available at preconfigure
+ # time, but then no languages are used either.
+ if python </dev/null 2>/dev/null ; then
+ # list_lists may fail if mm_cfg is not yet installed
+ ( for ml in $(/usr/sbin/list_lists -b 2>/dev/null); do
+ ( /usr/sbin/config_list -o - ${ml} 2>/dev/null
+ cat <<EOF
+try: print '\n'.join(available_languages)
+except: pass
+EOF
+ ) | python -W ignore::DeprecationWarning
+ done
+ ) | sort | uniq
+ fi
+}
+
+# This script will be invoked by apt-get 2 times in a row, once when
+# preconfiguring the package and a second time just before running the
+# postinst script. OTOH when installing the package with dpkg or when
+# reconfiguring the package, it runs only once.
+#
+# It scans all mailing lists on a system for used languages which may
+# be quite time consuming on systems with many lists; hence we better
+# avoid to run that scan twice in a row.
+#
+# The debconf template mailman/used_languages holds the result of the
+# scan but is never presented to the user, instead its scanned flag
+# indicates if it holds a fresh value and is reset by the postinst,
+# while its seen flag is mainly used for cosmetical reasons to mark
+# processed values in debconf-show output.
+
+db_get mailman/used_languages || true
+used_languages="${RET}"
+db_fget mailman/used_languages scanned || true
+scanned="${RET}"
+
+if [ ! -z "$2" ] && dpkg --compare-versions $2 lt 2.1 ; then
+ # list_lists will fail when upgrading from pre 2.1; but with those
+ # versions not supporting i18n, english was the only used language.
+ db_set mailman/site_languages "en"
+ db_set mailman/used_languages "en"
+ db_fset mailman/used_languages scanned false
+elif [ ! -x "/usr/sbin/list_lists" ] ; then
+ # For 1st time installers there is no used language.
+ db_set mailman/site_languages "en"
+ db_set mailman/used_languages ""
+ db_fset mailman/used_languages scanned false
+else
+ if [ "${scanned}" != "true" ] ; then
+ echo -n "Looking for enabled languages (this may take some time) ..."
+ unset used_languages
+ for l in $(get_used_languages); do
+ used_languages=${used_languages:+${used_languages} }$l
+ done
+ db_set mailman/used_languages "${used_languages}"
+ db_fset mailman/used_languages scanned true
+ db_fset mailman/used_languages seen false
+ echo " done."
+ fi
+ # 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')"
+ need_languages="${site_languages}"
+ for lang in ${used_languages} ; do
+ if echo " ${site_languages} " | grep -v -q " ${lang} " ; then
+ need_languages="${lang} ${need_languages}"
+ fi
+ done
+ if [ "${need_languages}" != "${site_languages}" ]; then
+ db_set mailman/site_languages "$(echo ${need_languages} | sed -e 's/ */, /g')"
+ fi
+fi
+
+db_go || true
Property changes on: branches/pkg-split/core/debian/mailman-i18n.config
___________________________________________________________________
Name: svn:keywords
+ Id URL