dropbear: honor CONFIG_TARGET_INIT_PATH
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 8 Feb 2016 14:28:57 +0000 (14:28 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 8 Feb 2016 14:28:57 +0000 (14:28 +0000)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 48679

package/network/services/dropbear/Makefile
package/network/services/dropbear/patches/500-set-default-path.patch

index 65a5e79608c840dedc031d6568576c1323b0adab..39ab04bb54c734489e9c5c42bb7bce1fa0b971b9 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
 PKG_VERSION:=2015.71
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -23,10 +23,14 @@ PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
 PKG_BUILD_PARALLEL:=1
 PKG_USE_MIPS16:=0
 
-PKG_CONFIG_DEPENDS:=CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_CURVE25519
+PKG_CONFIG_DEPENDS:=CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_CURVE25519
 
 include $(INCLUDE_DIR)/package.mk
 
+ifneq ($(DUMP),1)
+  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) echo $(CONFIG_TARGET_INIT_PATH) | md5s)
+endif
+
 define Package/dropbear/Default
   URL:=http://matt.ucc.asn.au/dropbear/
 endef
@@ -74,12 +78,15 @@ CONFIGURE_ARGS += \
        --disable-zlib \
        --enable-bundled-libtom
 
-TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections
+TARGET_CFLAGS += -DDEFAULT_PATH=\\\"$(TARGET_INIT_PATH)\\\" -DARGTYPE=3 -ffunction-sections -fdata-sections
 TARGET_LDFLAGS += -Wl,--gc-sections
 
 define Build/Configure
        $(Build/Configure/Default)
 
+       $(SED) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(TARGET_INIT_PATH)",g' \
+               $(PKG_BUILD_DIR)/options.h
+
        awk 'BEGIN { rc = 1 } \
             /'DROPBEAR_CURVE25519'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_CURVE25519),,// )#define 'DROPBEAR_CURVE25519'"; rc = 0 } \
             { print } \
@@ -97,6 +104,9 @@ define Build/Configure
               >$(PKG_BUILD_DIR)/options.h.new && \
          mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h || exit 1; \
        done
+
+       # Enforce rebuild of svr-chansession.c
+       rm -f $(PKG_BUILD_DIR)/svr-chansession.o
 endef
 
 define Build/Compile
index 648c391ced95d9ee6245d6e1cb05130e914cee83..3f65250a9775c6f875ae034e5d853cea97ceb03e 100644 (file)
@@ -1,11 +1,12 @@
 --- a/options.h
 +++ b/options.h
-@@ -347,7 +347,7 @@ be overridden at runtime with -I. 0 disa
+@@ -347,7 +347,9 @@ be overridden at runtime with -I. 0 disa
  #define DEFAULT_IDLE_TIMEOUT 0
  
  /* The default path. This will often get replaced by the shell */
--#define DEFAULT_PATH "/usr/bin:/bin"
-+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin"
++#ifndef DEFAULT_PATH
+ #define DEFAULT_PATH "/usr/bin:/bin"
++#endif
  
  /* Some other defines (that mostly should be left alone) are defined
   * in sysoptions.h */