comparison debian/dropbear.init @ 285:1b9e69c058d2

propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 20dccfc09627970a312d77fb41dc2970b62689c3) to branch 'au.asn.ucc.matt.dropbear' (head fdf4a7a3b97ae5046139915de7e40399cceb2c01)
author Matt Johnston <matt@ucc.asn.au>
date Wed, 08 Mar 2006 13:23:58 +0000
parents c66797d973ff
children c23c7f0f594c
comparison
equal deleted inserted replaced
281:997e6f7dc01e 285:1b9e69c058d2
1 #!/bin/sh
2 #
3 # Do not configure this file. Edit /etc/default/dropbear instead!
4 #
5
6 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7 DAEMON=/usr/sbin/dropbear
8 NAME=dropbear
9 DESC="Dropbear SSH server"
10
11 DROPBEAR_PORT=22
12 DROPBEAR_EXTRA_ARGS=
13 NO_START=0
14
15 set -e
16
17 cancel() { echo "$1" >&2; exit 0; };
18 test ! -r /etc/default/dropbear || . /etc/default/dropbear
19 test -x "$DAEMON" || cancel "$DAEMON does not exist or is not executable."
20 test ! -h /var/service/dropbear || \
21 cancel '/var/service/dropbear exists, service is controlled through runit.'
22
23 test -z "$DROPBEAR_BANNER" || \
24 DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
25 test -n "$DROPBEAR_RSAKEY" || \
26 DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key"
27 test -n "$DROPBEAR_DSSKEY" || \
28 DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key"
29
30 case "$1" in
31 start)
32 test "$NO_START" = "0" || cancel 'NO_START is not set to zero.'
33 echo -n "Starting $DESC: "
34 start-stop-daemon --start --quiet --pidfile /var/run/"$NAME".pid \
35 --exec "$DAEMON" -- -d "$DROPBEAR_DSSKEY" -r "$DROPBEAR_RSAKEY" \
36 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
37 echo "$NAME."
38 ;;
39 stop)
40 echo -n "Stopping $DESC: "
41 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME".pid
42 echo "$NAME."
43 ;;
44 restart|force-reload)
45 test "$NO_START" = "0" || cancel 'NO_START is not set to zero.'
46 echo -n "Restarting $DESC: "
47 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME".pid
48 sleep 1
49 start-stop-daemon --start --quiet --pidfile /var/run/"$NAME".pid \
50 --exec "$DAEMON" -- -d "$DROPBEAR_DSSKEY" -r "$DROPBEAR_RSAKEY" \
51 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
52 echo "$NAME."
53 ;;
54 *)
55 N=/etc/init.d/$NAME
56 echo "Usage: $N {start|stop|restart|force-reload}" >&2
57 exit 1
58 ;;
59 esac
60
61 exit 0