File: telnetd.postinst

package info (click to toggle)
netkit-telnet 0.17-41.2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,412 kB
  • sloc: cpp: 6,451; ansic: 4,263; sh: 110; makefile: 64
file content (59 lines) | stat: -rw-r--r-- 1,462 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
51
52
53
54
55
56
57
58
59
#!/bin/sh
# $Id: telnetd.postinst,v 1.15 2003/10/24 12:52:18 herbert Exp $

set -e

update_inetd_entry() {
	if [ $2 ]; then
		update-inetd --remove ".*telnet"
		update-inetd --group STANDARD --add "$telnetdent"
	else
		update-inetd --remove ".*telnet"
		update-inetd --group STANDARD --add "$rootent"
	fi
}

if ! id -u telnetd >/dev/null 2>&1; then
	if getent group telnetd >/dev/null; then
		adduser --quiet --no-create-home --disabled-password --system --ingroup telnetd --home /nonexistent telnetd
	else
		adduser --quiet --no-create-home --disabled-password --system --group --home /nonexistent telnetd
	fi
fi
adduser --quiet telnetd utmp

if [ -z "$(dpkg-statoverride --list /usr/lib/telnetlogin)" ]; then
	chown root:telnetd /usr/lib/telnetlogin
	chmod 4754 /usr/lib/telnetlogin
fi

rootent="telnet		stream	tcp	nowait	root	/usr/sbin/tcpd	/usr/sbin/in.telnetd"
telnetdent="telnet		stream	tcp	nowait	telnetd	/usr/sbin/tcpd	/usr/sbin/in.telnetd"

if egrep -q "^(devpts /dev/pts|devfs /dev) " /proc/mounts; then
	devpts=yes
else
	devpts=
fi

case "$1" in
abort-upgrade | abort-deconfigure | abort-remove)
	update-inetd --enable telnet
	;;
configure)
	if [ -z "$2" ] || 
       dpkg --compare-versions "$2" lt 0.17-13 ||
       ( test -f /etc/inetd.conf && fgrep -q telnetd-ssl /etc/inetd.conf )
    then
		update_inetd_entry "$2" $devpts
	else
		update-inetd --enable telnet
	fi
	;;
*)
	printf "$0: incorrect arguments: $*\n" >&2
	exit 1
	;;
esac

#DEBHELPER#