[package] add dropkey ssh keys and config files to the conffiles section (#2014)
[openwrt-10.03/.git] / package / dropbear / files / dropbear.init
index 58b0bc2fabe99b032663c97b0f5ffc305ef42f4a..aaa4470432af3d1ad2a4d7417d9cfb7d6b6d0829 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2006 OpenWrt.org
+START=50
 # Copyright (C) 2006 Carlos Sobrinho
 
 config_cb() {
@@ -16,7 +17,7 @@ config_cb() {
                        case "$passauth" in
                                no|off|disabled|0) nopasswd=1;;
                        esac
-                       DROPBEAR_ARGS="${port:+-p $port} ${nopasswd:+-s}"
+                       DROPBEAR_ARGS="${nopasswd:+-s }${port:+-p $port}"
                ;;
        esac
 }
@@ -25,7 +26,7 @@ keygen() {
        for keytype in rsa dss; do
                # check for keys
                key=dropbear/dropbear_${keytype}_host_key
-               [ -f /tmp/$key -o -f /etc/$key ] || {
+               [ -f /tmp/$key -o -s /etc/$key ] || {
                        # generate missing keys
                        mkdir -p /tmp/dropbear
                        [ -x /usr/bin/dropbearkey ] && {
@@ -44,8 +45,8 @@ keygen() {
 }
 
 start() {
-       [ -f /etc/dropbear/dropbear_rsa_host_key -a \
-         -f /etc/dropbear/dropbear_dss_host_key ] || keygen
+       [ -s /etc/dropbear/dropbear_rsa_host_key -a \
+         -s /etc/dropbear/dropbear_dss_host_key ] || keygen
        
        config_load dropbear
        /usr/sbin/dropbear $DROPBEAR_ARGS