File: postinst

package info (click to toggle)
popa3d 1.0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 480 kB
  • sloc: ansic: 2,334; sh: 106; makefile: 61
file content (50 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download
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
#!/bin/sh
# post-installation script for popa3d

set -e

version_deprecating_debconf="1.0.3-2~"
inetd_config='pop3\t\tstream\ttcp\tnowait\troot\t/usr/sbin/tcpd\t/usr/sbin/popa3d'

# Source the debconf library.
. /usr/share/debconf/confmodule

if [ "$1" = "configure" ] && \
    dpkg --compare-versions "$2" lt-nl $version_deprecating_debconf
then
    db_get popa3d/standalone
    if [ "$RET" != "true" ]; then
	update-inetd --group MAIL --add "$inetd_config" 2>/dev/null

	# Print one-off notice if standalone mode was previously off
	# (not the default) to switch to using socket activation.
	#
	# It is not easy to do this programmatically without doubling up on
	# debhelper duties, which is error-prone.
	#
	# The information is targetd at only those already using inetd.
	#
	if [ -n "$(ls $DPKG_ROOT/etc/rc[2345].d/S[0-9][0-9]popa3d)" ]
	then
	    db_input high popa3d/config-removal
	    db_go
	fi
    else
	update-inetd --group MAIL --add "#<off># $inetd_config" 2>/dev/null
    fi
elif [ "$1" = "configure" ]
then
    # Add a disabled entry fo ease of user enablement now that we are
    # not offering assistance via debconf or environment variables
    update-inetd --group MAIL --add "#<off># $inetd_config" 2>/dev/null
fi

#DEBHELPER#

if [ "$1" = "configure" ] && \
    dpkg --compare-versions "$2" lt-nl $version_deprecating_debconf
then
    db_purge || true
    db_stop || true
    rm -f $DPKG_ROOT/etc/default/popa3d
fi