This file is indexed.

postinst is in sympa 6.2.24~dfsg-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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#!/bin/sh

#
# postinst script for sympa
#

set -e

if [ -f /usr/share/debconf/confmodule ]; then
    . /usr/share/debconf/confmodule
fi

if [ -f /usr/share/dbconfig-common/dpkg/postinst ]; then
    . /usr/share/dbconfig-common/dpkg/postinst
fi

if [ -f "/etc/sympa/sympa/sympa.conf" ] || [ ! -f "/etc/sympa/sympa.conf" ]; then
    conf=/etc/sympa/sympa/sympa.conf
else
    conf=/etc/sympa/sympa.conf
fi

sympa_version() {
    perl -e "use lib '/usr/share/sympa/lib'; use Sympa::Constants; print Sympa::Constants::VERSION;"
}

sympa_config_update() {
    key="${1}"
    value="${2}"
    if [ -n "${value}" ]; then
        if grep -qE "^\s*${key}\s+" "${conf}" ; then
            sed -r -i "s~^\s*${key}\s+.*\$~${key}\t${value}~" "${conf}"
        elif grep -qE "^\s*#\s*${key}\s+" "${conf}" ; then
            sed -r -i "s~^\s*#\s*${key}\s+.*\$~${key}\t${value}~" "${conf}"
        else
            printf "${key}\t${value}\n" >> "${conf}"
        fi
    else
        sed -r -i "s~^\s*(${key}\s+.*)\$~#\1~" "${conf}"
    fi
}

# creating sympa user if he isn't already there
if ! getent passwd sympa >/dev/null ; then
    echo "Adding system user: sympa."
    # We use --force-badname in case of a not compatible NAME_REGEX in /etc/adduser.conf (see #328053)
    adduser --force-badname --system --group --gecos "Sympa mailing list manager" --no-create-home --home /var/lib/sympa sympa >/dev/null
fi

# /etc/sympa/data_structure.version should not be handled as a conffile as it
# is modified by sympa upgrade tool and it breaks the sympa upgrade process
# itsself (#655967)
if [ -f /etc/sympa/data_structure.version ] && [ ! -f /etc/sympa/data_structure.version.debian-old ]; then
    cp /etc/sympa/data_structure.version /etc/sympa/data_structure.version.debian-old
fi
if which dpkg-maintscript-helper >/dev/null && dpkg-maintscript-helper supports rm_conffile ; then
    dpkg-maintscript-helper rm_conffile /etc/sympa/data_structure.version \
        "6.1.11~dfsg-1~" -- "$@"
fi

# Ensure that data structure version file exists and is writable for Sympa
if [ -f /etc/sympa/data_structure.version.debian-old ]; then
    cp /etc/sympa/data_structure.version.debian-old /etc/sympa/data_structure.version
    rm -f /etc/sympa/data_structure.version.debian-old
fi
if [ ! -f /etc/sympa/data_structure.version ]; then
    sympa_version > /etc/sympa/data_structure.version
fi

# Remove conffiles used by apache2 < 2.4
if which dpkg-maintscript-helper >/dev/null && dpkg-maintscript-helper supports rm_conffile ; then
    for i in apache apache-soap httpd.conf-cgi httpd.conf-fcgi ; do
        dpkg-maintscript-helper rm_conffile "/etc/sympa/${i}" \
            "6.1.17~dfsg-1~" -- "$@"
    done
fi

# Stop the daemon if it has already been started This is necessary when you run
# dpkg-reconfigure
if [ "$1" = "configure" ]; then
    if [ -f /etc/init.d/sympa ]; then
        if which invoke-rc.d >/dev/null 2>&1; then
            invoke-rc.d sympa stop || true
        else
            /etc/init.d/sympa stop || true
        fi
    fi
fi

# Install sympa.conf
if [ ! -f "$conf" ]; then
    # Create congfiguration file
    /usr/lib/sympa/bin/sympa_wizard.pl --create sympa.conf --target "$conf"
fi

# Configure the language
db_get sympa/language
sympa_config_update "lang" "${RET}"

# Get the hostname
db_get sympa/hostname
hostname="${RET}"
sympa_config_update "domain" "${hostname}"

db_get sympa/listmaster
listmaster="${RET}"
if ! echo "${listmaster}" | grep -qE '^.+@.+$' ; then
    listmaster="listmaster@${hostname}"
fi
sympa_config_update "listmaster" "${listmaster}"

# Create file for mailing list aliases
if [ ! -f /etc/mail/sympa/aliases ]; then
    echo "## List aliases used for the sympa mailing-list manager" > /etc/mail/sympa/aliases
fi

# Moving alias files to a destination where SYMPA can write
# and create the db alias file with the right permissions
# from /etc/mail/sympa.aliases to /etc/mail/sympa/aliases
if [ -d /etc/mail/sympa ]; then
    chown sympa:sympa /etc/mail/sympa
    for ext in '' '.db' ; do
        if [ ! -f /etc/mail/sympa/aliases${ext} ] && [ -f /etc/mail/sympa.aliases${ext} ] && [ ! -h /etc/mail/sympa/aliases${ext} ]; then
            mv /etc/mail/sympa.aliases${ext} /etc/mail/sympa/aliases${ext}
            ln -s /etc/mail/sympa/aliases${ext} /etc/mail/sympa.aliases${ext}
            chown -h sympa:sympa /etc/mail/sympa.aliases${ext}
        fi
    done
fi

# Ensure permissions are correct
for ext in '' '.db' ; do
    if [ -f /etc/mail/sympa/aliases${ext} ]; then
        chown sympa:sympa /etc/mail/sympa/aliases${ext}
    fi
done

# Remove old sympa aliases
if [ -f /etc/aliases ]; then
    sed -i -e '/#-- SYMPA begin/,/#-- SYMPA end/d' /etc/aliases
    newaliases || true
fi

## Create a unique cookie for this host
if [ ! -e /etc/sympa/cookie ]; then
    touch /etc/sympa/cookie
    chmod 0660 /etc/sympa/cookie
    if [ -r /dev/urandom ]; then
        dd if=/dev/urandom bs=1k count=1 2>/dev/null \
        | md5sum | cut -d " " -f 1 >>/etc/sympa/cookie
    else
        (free; uptime; ps aux) | md5sum | cut -d " " -f 1 >>/etc/sympa/cookie
    fi
fi

if [ ! -e /etc/sympa/cookies.history ]; then
    cp /etc/sympa/cookie /etc/sympa/cookies.history
    chmod 0660 /etc/sympa/cookies.history
fi

sympa_config_update "cookie" "\`/usr/bin/head -n1 /etc/sympa/cookie\`"

## Look for bad path in aliases file (why the hell did they move the files ?)
if grep -q "/usr/lib/sympa/queue" /etc/aliases ; then
    echo "WARNING : The path of the queue program is bad in the aliases file"
    echo "Change /usr/lib/sympa/queue by /usr/lib/sympa/bin/queue !"
    echo "I'll create a symlink to prevent problems from happening..."
    echo ""
    ln -sf bin/queue /usr/lib/sympa/queue
fi

db_get sympa/dbconfig-install
if [ "${RET}" != 'false' ]; then
    dbc_first_version="5.3.4-6~"
    dbc_dbfile_owner="sympa:sympa"
    dbc_go sympa $@

    # Translate database parameters from dbconfig-common to Sympa's db_xxx
    # configuration values
    case "$dbc_dbtype" in
        mysql)
            type=mysql
            ;;
        pgsql)
            type=Pg
            ;;
        sqlite3)
            type=SQLite
            dbc_dbname="${dbc_basepath}/${dbc_dbname}"
            ;;
        *)
            echo "Unsupported database type $dbc_dbtype."
            exit 1
            ;;
    esac
    # Install the database configuration
    sympa_config_update "db_type" "${type}"
    sympa_config_update "db_name" "${dbc_dbname}"
    sympa_config_update "db_host" "${dbc_dbserver}"
    sympa_config_update "db_user" "${dbc_dbuser}"
    sympa_config_update "db_passwd" "${dbc_dbpass}"
    sympa_config_update "db_port" "${dbc_dbport}"
fi

echo "Ensuring that permissions and ownerships are right (this can take a while)..."
# Ensure permissions and ownerships are right
chown -R sympa:sympa /etc/sympa

if [ -e /var/log/sympa.log ] && [ ! -f /var/log/sympa.log ]; then
    echo "Problem: /var/log/sympa.log already exists and it isn't a file !"
fi
touch /var/log/sympa.log || true
chown sympa:sympa /var/log/sympa.log
chmod 0640 /var/log/sympa.log

# set default permissions for sympa's data directory except static_content
# which has to be readable by the webserver
find /var/lib/sympa /var/spool/sympa \
    -maxdepth 1 -type d -not -name 'static_content' \
    -exec chmod 0771 {} \;

# It's better to search files and directories with wrong owner/group and fix
# them instead of recursively doing it, even if it's not needed (see #630384)
find /var/spool/sympa /var/lib/sympa \
    \( -not -user sympa -or -not -group sympa \) \
    -exec chown sympa:sympa {} \;

# Fix permissions on CGI wrappers
chown sympa:sympa /usr/lib/cgi-bin/sympa/wwsympa-wrapper.fcgi \
    /usr/lib/cgi-bin/sympa/sympa_soap_server-wrapper.fcgi
chmod 6755 /usr/lib/cgi-bin/sympa/wwsympa-wrapper.fcgi \
    /usr/lib/cgi-bin/sympa/sympa_soap_server-wrapper.fcgi

# Fix permissions on newaliases wrapper
chmod u+s /usr/lib/sympa/bin/sympa_newaliases-wrapper

# WebServer configuration
db_get wwsympa/webserver_type
case "${RET}" in
    "Apache 2")
        webserver="apache2"
        ;;
    *)
        webserver="none"
        ;;
esac

# Read FastCGI setting
db_get wwsympa/fastcgi
fastcgi="${RET}"
if [ "$fastcgi" = "true" ] && [ $webserver = "apache2" ]; then
    if [ ! -f /etc/apache2/mods-enabled/fcgid.load ] && [ ! -f /etc/apache2/mods-enabled/fastcgi.load ]; then
        echo "FastCGI module not installed or enabled, skipping."
        fastcgi="false"
    fi
fi
if [ "$fastcgi" = "true" ]; then
    sympa_config_update "use_fast_cgi" "1"
else
    sympa_config_update "use_fast_cgi" "0"
fi

db_get wwsympa/wwsympa_url
sympa_config_update "wwsympa_url" "${RET}"

db_get sympa/use_soap
use_soap="${RET}"
if [ "$use_soap" = "true" ]; then
    sympa_config_update "soap_url" "http://${hostname}/sympasoap"
else
    sympa_config_update "soap_url" ""
fi

# Cleanup sympa configuration files used by Apache2 << 2.4
for suffix in '' '-soap' ; do
    if [ -h "/etc/apache2/conf.d/sympa${suffix}" ] && \
        [ "$(readlink -f "/etc/apache2/conf.d/sympa${suffix}")" = "/etc/sympa/apache${suffix}" ]; then
        rm -f "/etc/apache2/conf.d/sympa${suffix}"
    fi
done

# WebServer configuration
db_get wwsympa/webserver_type
webserver="${RET}"
if [ "$webserver" = "Apache 2" ]; then
    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
        # Apache2 >= 2.4
        . /usr/share/apache2/apache2-maintscript-helper
        apache2_invoke enconf sympa.conf
        if [ "$use_soap" = "true" ]; then
            apache2_invoke enconf sympa-soap.conf
        else
            apache2_invoke disconf sympa-soap.conf
        fi
    fi
else
    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
        # Apache2 >= 2.4
        . /usr/share/apache2/apache2-maintscript-helper
        apache2_invoke disconf sympa.conf
        apache2_invoke disconf sympa-soap.conf
    fi
fi

echo "Moving configuration files for Sympa >= 6.2 (if required)"
su -l sympa -s /bin/sh -c "/usr/lib/sympa/bin/sympa.pl --upgrade_config_location"

echo "Upgrading Sympa internals (health check)"
su -l sympa -s /bin/sh -c "/usr/lib/sympa/bin/sympa.pl --health_check"

echo "Upgrading Sympa internals (upgrade)"
su -l sympa -s /bin/sh -c "/usr/lib/sympa/bin/sympa.pl --upgrade"

echo "Move messages stored in database to filesystem (if required)"
su -l sympa -s /bin/sh -c "/usr/share/sympa/bin/upgrade_bulk_spool.pl" || true

echo "Move messages sent through the web interface to the new formalism (if required)"
su -l sympa -s /bin/sh -c "/usr/share/sympa/bin/upgrade_send_spool.pl"

## End up with debconf
db_stop

# Automatically added by dh_systemd_enable/11ubuntu1
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'sympa.service' >/dev/null || true

# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'sympa.service'; then
	# Enables the unit on first installation, creates new
	# symlinks on upgrades if the unit file has changed.
	deb-systemd-helper enable 'sympa.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 'sympa.service' >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit/11ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
	if [ -x "/etc/init.d/sympa" ]; then
		update-rc.d sympa defaults >/dev/null
		invoke-rc.d sympa start || exit $?
	fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/11ubuntu1
if [ -d /run/systemd/system ]; then
	systemctl --system daemon-reload >/dev/null || true
	deb-systemd-invoke start 'sympa-archived.service' 'sympa-bounced.service' 'sympa-bulk.service' 'sympa-task_manager.service' >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installdeb/11ubuntu1
dpkg-maintscript-helper rm_conffile /etc/sympa/sympa/sympa.conf "6.2.16~dfsg-2~" -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11ubuntu1
dpkg-maintscript-helper rm_conffile /etc/sympa/sympa.conf-smime.in "6.2.16~dfsg-4~" -- "$@"
# End automatically added section


exit 0