- touch $@
-
-$(IPKG_DBCONVERT):
- mkdir -p $(IDIR_DBCONVERT)/usr/bin
- install -m 755 $(PKG_BUILD_DIR)/dropbearconvert \
- $(IDIR_DBCONVERT)/usr/bin/dropbearconvert
- $(IPKG_BUILD) $(IDIR_DBCONVERT) $(PACKAGE_DIR)
-
-$(IPKG_DROPBEAR):
- mkdir -p $(IDIR_DROPBEAR)/usr/bin
- mkdir -p $(IDIR_DROPBEAR)/usr/sbin
- install -m 755 $(PKG_BUILD_DIR)/dropbearmulti \
- $(IDIR_DROPBEAR)/usr/sbin/dropbear
- $(STRIP) $(IDIR_DROPBEAR)/usr/sbin/dropbear
- ln -sf ../sbin/dropbear $(IDIR_DROPBEAR)/usr/bin/scp
- ln -sf ../sbin/dropbear $(IDIR_DROPBEAR)/usr/bin/ssh
- ln -sf ../sbin/dropbear $(IDIR_DROPBEAR)/usr/bin/dbclient
- ln -sf ../sbin/dropbear $(IDIR_DROPBEAR)/usr/bin/dropbearkey
- mkdir -p $(IDIR_DROPBEAR)/etc/init.d
- install -m 755 ./files/S50dropbear $(IDIR_DROPBEAR)/etc/init.d/
- $(IPKG_BUILD) $(IDIR_DROPBEAR) $(PACKAGE_DIR)
+endef
+
+define Package/dropbear/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
+ $(INSTALL_DIR) $(1)/usr/bin
+ ln -sf ../sbin/dropbear $(1)/usr/bin/scp
+ ln -sf ../sbin/dropbear $(1)/usr/bin/ssh
+ ln -sf ../sbin/dropbear $(1)/usr/bin/dbclient
+ ln -sf ../sbin/dropbear $(1)/usr/bin/dropbearkey
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
+ $(INSTALL_DIR) $(1)/usr/lib/opkg/info
+ $(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
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
+endef
+
+$(eval $(call BuildPackage,dropbear))
+$(eval $(call BuildPackage,dropbearconvert))