comparison debian/dropbear.init @ 389:5ff8218bcee9

propagate from branch 'au.asn.ucc.matt.ltm.dropbear' (head 2af95f00ebd5bb7a28b3817db1218442c935388e) to branch 'au.asn.ucc.matt.dropbear' (head ecd779509ef23a8cdf64888904fc9b31d78aa933)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 03:14:55 +0000
parents c66797d973ff
children c23c7f0f594c
comparison
equal deleted inserted replaced
388:fb54020f78e1 389:5ff8218bcee9
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