madwifi: improve beacon miss handling to increase the reliability of STA mode links
[openwrt.git] / package / dropbear / files / dropbear.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3 START=50
4 # Copyright (C) 2006 Carlos Sobrinho
5
6 config_cb() {
7 local cfg="$CONFIG_SECTION"
8 local nopasswd
9 local cfgt
10 config_get cfgt "$cfg" TYPE
11
12 case "$cfgt" in
13 dropbear)
14 config_get passauth $cfg PasswordAuth
15 config_get port $cfg Port
16
17 case "$passauth" in
18 no|off|disabled|0) nopasswd=1;;
19 esac
20 DROPBEAR_ARGS="${nopasswd:+-s }${port:+-p $port}"
21 ;;
22 esac
23 }
24
25 keygen() {
26 for keytype in rsa dss; do
27 # check for keys
28 key=dropbear/dropbear_${keytype}_host_key
29 [ -f /tmp/$key -o -f /etc/$key ] || {
30 # generate missing keys
31 mkdir -p /tmp/dropbear
32 [ -x /usr/bin/dropbearkey ] && {
33 /usr/bin/dropbearkey -t $keytype -f /tmp/$key 2>&- >&- && exec /etc/rc.common "$initscript" start
34 } &
35 exit 0
36 }
37 done
38
39 lock /tmp/.switch2jffs
40 mkdir -p /etc/dropbear
41 mv /tmp/dropbear/dropbear_* /etc/dropbear/
42 lock -u /tmp/.switch2jffs
43 chown root /etc/dropbear
44 chmod 0700 /etc/dropbear
45 }
46
47 start() {
48 [ -f /etc/dropbear/dropbear_rsa_host_key -a \
49 -f /etc/dropbear/dropbear_dss_host_key ] || keygen
50
51 config_load dropbear
52 /usr/sbin/dropbear $DROPBEAR_ARGS
53 }
54
55 stop() {
56 killall dropbear
57 }
This page took 0.04247 seconds and 5 git commands to generate.