This file is indexed.

postinst is in mailman 1:2.1.16-2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
#! /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://tg@svn.debian.org/svn/pkg-mailman/branches/experimental/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 [ -x "/etc/init.d/mailman" ] || [ -e "/etc/init/mailman.conf" ]; then
	if [ ! -e "/etc/init/mailman.conf" ]; then
		update-rc.d mailman defaults >/dev/null
	fi
	invoke-rc.d mailman start || exit $?
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