File: postinst

package info (click to toggle)
netkit-base 0.10-9
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,492 kB
  • ctags: 1,349
  • sloc: ansic: 8,544; sh: 220; makefile: 129
file content (56 lines) | stat: -rw-r--r-- 1,652 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -e

if [ "$1" = "configure" ]; then
	if [ -e /usr/share/debconf/confmodule ]; then
		. /usr/share/debconf/confmodule
    		db_get netkit-inetd/inetd-dos-services; DISABLE_INETD_DOS="$RET"
	else
		DISABLE_INETD_DOS=true
	fi
fi

if [ "$1" = "configure" ]; then
        if [ "$DISABLE_INETD_DOS" = "true" -a -f /etc/inetd.conf ] &&
	    egrep -q '(^chargen|^echo|^daytime.*udp.*internal|^time.*udp.*internal)' /etc/inetd.conf
	then
		sed -e 's/^chargen.*stream.*tcp.*nowait.*root.*internal/#&/' \
		    -e 's/^chargen.*dgram.*udp.*wait.*root.*internal/#&/' \
		    -e 's/^echo.*stream.*tcp.*nowait.*root.*internal/#&/' \
		    -e 's/^echo.*dgram.*udp.*wait.*root.*internal/#&/' \
		    -e 's/^daytime.*dgram.*udp.*wait.*root.*internal/#&/' \
		    -e 's/^time.*dgram.*udp.*wait.*root.*internal/#&/' \
		    /etc/inetd.conf >/etc/inetd.tmp

		cp -a /etc/inetd.conf /etc/inetd.conf.dpkg-old
		# if sed was successful: size of inetd.tmp > size of 
		# /etc/inetd.conf
		TMPSIZE=`cat /etc/inetd.tmp | wc -c`
		OLDSIZE=`cat /etc/inetd.conf | wc -c`
		if [ "$TMPSIZE" -gt "$OLDSIZE" ]; then
			cp /etc/inetd.tmp /etc/inetd.conf
		fi
		rm -f /etc/inetd.tmp
	fi


	update-rc.d inetd defaults 20 >/dev/null 2>&1

	if [ "$2" = "" ]; then
		/etc/init.d/inetd start >&2
	else
		/etc/init.d/inetd restart >&2
	fi
fi

##DEBHELPER##

# shouldn't be necessary? but without it the postinst just hangs on dpkg -i :(
#
# do i have to do this right at the end, or can i do it earlier, for that
# matter?
#
# i may be meant to redirect 3>&1 or something equally weird here :-/

if [ "$1" = "configure" ] && [ -e /usr/share/debconf/confmodule ]; then
    db_stop 
fi