Annotation of /trunk/dropbear/dropbear.rc
Parent Directory | Revision Log
Revision 650 -
(hide annotations)
(download)
Tue Jun 10 22:19:59 2008 UTC (16 years, 3 months ago) by niro
File size: 1191 byte(s)
Tue Jun 10 22:19:59 2008 UTC (16 years, 3 months ago) by niro
File size: 1191 byte(s)
-busybox-initscripts compat
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 | echo -e ${COLOREDSTAR}"Generating DSS-Hostkey ..." | ||
21 | /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 | echo -e ${COLOREDSTAR}"Generating RSA-Hostkey ..." | ||
27 | /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 | echo -e ${COLOREDSTAR}"Starting Dropbear SSH Server ..." | ||
35 | /usr/sbin/dropbear | ||
36 | evaluate_retval | ||
37 | |||
38 | update_svcstatus $1 | ||
39 | splash svc_started "$(basename $0)" 0 | ||
40 | ;; | ||
41 | |||
42 | stop) | ||
43 | echo -e ${COLOREDSTAR}"Stopping Dropbear SSH Server ..." | ||
44 | 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 | echo "Usage: $0 {start|stop|restart|status}" | ||
63 | exit 1 | ||
64 | ;; | ||
65 | esac |