This file is indexed.

postinst is in mailman 1:2.1.26-1.

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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#! /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, ...
. /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_installsystemd/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# In case this system is running systemd, we need to ensure that all
	# necessary tmpfiles (if any) are created before starting.
	if [ -d /run/systemd/system ] ; then
		systemd-tmpfiles --create /usr/lib/tmpfiles.d/mailman.conf >/dev/null || true
	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.7-
fi

# End automatically added section
# Automatically added by dh_installsystemd/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'mailman.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'mailman.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'mailman.service' >/dev/null || true
	else
		# Update the statefile to add new symlinks (if any), which need to be
		# cleaned up on purge. Also remove old symlinks.
		deb-systemd-helper update-state 'mailman.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
		if [ -d /run/systemd/system ]; then
			systemctl --system daemon-reload >/dev/null || true
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		deb-systemd-invoke $_dh_action 'mailman.service' >/dev/null || true
	fi
fi
# End automatically added section