kconfig.pl: throw warnings into stderr instead of stdout
[openwrt.git] / package / dropbear / files / dropbear.init
index ef69e90..aaa4470 100755 (executable)
@@ -1,14 +1,15 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2006 OpenWrt.org
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2006 OpenWrt.org
+START=50
 # Copyright (C) 2006 Carlos Sobrinho
 
 config_cb() {
        local cfg="$CONFIG_SECTION"
        local nopasswd
 # Copyright (C) 2006 Carlos Sobrinho
 
 config_cb() {
        local cfg="$CONFIG_SECTION"
        local nopasswd
-       local type
-       config_get cfgtype "$cfg" TYPE
+       local cfgt
+       config_get cfgt "$cfg" TYPE
 
 
-       case "$cfgtype" in
+       case "$cfgt" in
                dropbear)
                        config_get passauth $cfg PasswordAuth
                        config_get port $cfg Port
                dropbear)
                        config_get passauth $cfg PasswordAuth
                        config_get port $cfg Port
@@ -16,7 +17,7 @@ config_cb() {
                        case "$passauth" in
                                no|off|disabled|0) nopasswd=1;;
                        esac
                        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
 }
                ;;
        esac
 }
@@ -25,7 +26,7 @@ keygen() {
        for keytype in rsa dss; do
                # check for keys
                key=dropbear/dropbear_${keytype}_host_key
        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 ] && {
                        # generate missing keys
                        mkdir -p /tmp/dropbear
                        [ -x /usr/bin/dropbearkey ] && {
@@ -44,8 +45,8 @@ keygen() {
 }
 
 start() {
 }
 
 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
        
        config_load dropbear
        /usr/sbin/dropbear $DROPBEAR_ARGS
This page took 0.029585 seconds and 4 git commands to generate.