add some more checks to the telnet init script
[openwrt-10.03/.git] / package / busybox / files / telnet
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 start() {
5         if      [ \! -f /etc/passwd ] || \
6                 awk -F: '/^root:/ && ($2 != "") && ($2 !~ /\!/) {exit 1}' /etc/passwd 2>/dev/null || \
7                 [ \! -x /usr/sbin/dropbear ]
8         then \
9                 telnetd -l /bin/login
10         fi
11 }
12
13 stop() {
14         killall telnetd
15 }