add dropkey ssh keys and config files to the conffiles section (#2014)
authorFlorian Fainelli <florian@openwrt.org>
Tue, 3 Feb 2009 22:28:16 +0000 (22:28 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Tue, 3 Feb 2009 22:28:16 +0000 (22:28 +0000)
SVN-Revision: 14399

package/dropbear/Makefile
package/dropbear/files/dropbear.init

index a98c24aa2aa5dc59a88fa8e2acfef80bc1df9f3d..5943fc62c066b9ef2a8c22838cb4e91dcfd01ddd 100644 (file)
@@ -35,6 +35,12 @@ define Package/dropbear/description
  A small SSH2 server/client designed for small memory environments.
 endef
 
+define Package/dropbear/conffiles
+/etc/dropbear/dropbear_rsa_host_key
+/etc/dropbear/dropbear_dss_host_key 
+/etc/config/dropbear 
+endef
+
 define Package/dropbearconvert
   $(call Package/dropbear/Default)
   SECTION:=utils
@@ -89,8 +95,9 @@ define Package/dropbear/install
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
        $(INSTALL_DIR) $(1)/usr/lib/opkg/info
-       echo /etc/dropbear/dropbear_rsa_host_key > $(1)/usr/lib/opkg/info/dropbear.conffiles
-       echo /etc/dropbear/dropbear_dss_host_key >> $(1)/usr/lib/opkg/info/dropbear.conffiles
+       $(INSTALL_DIR) $(1)/etc/dropbear
+       touch $(1)/etc/dropbear/dropbear_rsa_host_key
+       touch $(1)/etc/dropbear/dropbear_dss_host_key
 endef
 
 define Package/dropbearconvert/install
index f671df787e92e49bc4c94f8409cfd7a038f1c758..aaa4470432af3d1ad2a4d7417d9cfb7d6b6d0829 100755 (executable)
@@ -26,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 ] && {
@@ -45,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