Annotation of /trunk/dropbear/dropbear.rc
Parent Directory | Revision Log
Revision 2128 -
(hide annotations)
(download)
Wed Mar 20 08:51:51 2013 UTC (11 years, 7 months ago) by niro
File size: 1142 byte(s)
Wed Mar 20 08:51:51 2013 UTC (11 years, 7 months ago) by niro
File size: 1142 byte(s)
-use rc_echo() and rc_print()
1 | niro | 452 | #!/bin/bash |
2 | niro | 650 | # $Header: /root/magellan-cvs/src/dropbear/dropbear.rc,v 1.2 2008-06-10 22:19:25 niro Exp $ |
3 | niro | 452 | |
4 | niro | 650 | #%rlevels: 3:s 0:k |
5 | niro | 452 | #%start: 30 |
6 | #%stop: 30 | ||
7 | |||
8 | #deps | ||
9 | #%needs: | ||
10 | #%before: | ||
11 | #%after: | ||
12 | |||
13 | niro | 650 | source /etc/conf.d/rc |
14 | source ${rc_functions} | ||
15 | niro | 452 | |
16 | gen_keys() | ||
17 | { | ||
18 | if [ ! -e /etc/dropbear/dropbear_dss_host_key ] | ||
19 | then | ||
20 | niro | 2128 | rc_print "Generating DSS-Hostkey ..." |
21 | niro | 452 | /usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key |
22 | fi | ||
23 | |||
24 | if [ ! -e /etc/dropbear/dropbear_rsa_host_key ] | ||
25 | then | ||
26 | niro | 2128 | rc_print "Generating RSA-Hostkey ..." |
27 | niro | 452 | /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key |
28 | fi | ||
29 | } | ||
30 | |||
31 | case "$1" in | ||
32 | start) | ||
33 | gen_keys | ||
34 | niro | 2128 | rc_print "Starting Dropbear SSH Server ..." |
35 | niro | 452 | /usr/sbin/dropbear |
36 | evaluate_retval | ||
37 | |||
38 | update_svcstatus $1 | ||
39 | splash svc_started "$(basename $0)" 0 | ||
40 | ;; | ||
41 | |||
42 | stop) | ||
43 | niro | 2128 | rc_print "Stopping Dropbear SSH Server ..." |
44 | niro | 452 | start-stop-daemon --stop --quiet --pidfile /var/run/dropbear.pid |
45 | evaluate_retval | ||
46 | |||
47 | update_svcstatus $1 | ||
48 | splash svc_stopped "$(basename $0)" 0 | ||
49 | ;; | ||
50 | |||
51 | restart) | ||
52 | $0 stop | ||
53 | sleep 1 | ||
54 | $0 start | ||
55 | ;; | ||
56 | |||
57 | status) | ||
58 | statusproc /usr/sbin/dropbear | ||
59 | ;; | ||
60 | |||
61 | *) | ||
62 | niro | 2128 | rc_echo "Usage: $0 {start|stop|restart|status}" |
63 | niro | 452 | exit 1 |
64 | ;; | ||
65 | esac |