aboutsummaryrefslogtreecommitdiffstats
path: root/debian/nyancat-server.postinst
blob: 757eea516969fba20f5b8a8577d6ca03a95ebb73 (plain)
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
#!/bin/sh

set -e

OLD_NYANCAT_ENTRY="telnet		stream	tcp	nowait	nobody	/usr/bin/nyancat	nyancat -t"
RELEASE="1.0+git20120523.99dc310-1"

case "$1" in
	configure)
		# if upgrading from previous non reconf-inetd version
		if dpkg --compare-versions "$2" lt-nl "$RELEASE"; then
			# remove previous update-inetd entry if unmodified
			if fgrep -qx "#<off># $OLD_NYANCAT_ENTRY" /etc/inetd.conf || \
				fgrep -qx "$OLD_NYANCAT_ENTRY" /etc/inetd.conf; then
					if [ -x /usr/sbin/update-inetd ]; then
						# remove nyancat reconf-inetd entries
						update-inetd --multi --pattern nyancat --remove telnet || true
						if [ -x /usr/sbin/reconf-inetd ]; then
							# add the nyancat-server entries back again
							reconf-inetd || true
						fi
					fi
				fi
		fi
	;;
esac

#DEBHELPER#