package/dropbear: add option to provide file with localoptions.h
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Wed, 29 May 2019 10:27:06 +0000 (13:27 +0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 1 Jun 2019 09:44:49 +0000 (11:44 +0200)
As discussed in https://patchwork.ozlabs.org/patch/1104071/, this
commit adds a new option that allows the user to provide a file that
contains custom definitions to tweak the Dropbear configuration. It
will be appended to Dropbear's localoptions.h file before the build.

The patch was tested successfully with the DO_MOTD option.

Suggested-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
[Thomas: tweak commit log, rename config option.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/dropbear/Config.in
package/dropbear/dropbear.mk

index 62f77bad9dd412faea4d3c5c9b75bc8613d3bd4c..e14a670c19e979ffbdbda4f3a81b4423c8b5c4ce 100644 (file)
@@ -66,4 +66,11 @@ config BR2_PACKAGE_DROPBEAR_LEGACY_CRYPTO
            DSA public keys
            Diffie-Hellman Group1 key exchange
 
+config BR2_PACKAGE_DROPBEAR_LOCALOPTIONS_FILE
+       string "path to custom localoptions.h definitions file"
+       help
+         Path to a file whose contents will be appended to Dropbear
+         localoptions.h. It can be used to tweak the Dropbear
+         configuration.
+
 endif
index e10c85160620c5bf1776378a03a6e94e5adba61b..185f8c43418770586849c23132f026631ce87820 100644 (file)
@@ -124,6 +124,14 @@ ifneq ($(BR2_PACKAGE_DROPBEAR_LASTLOG),y)
 DROPBEAR_CONF_OPTS += --disable-lastlog
 endif
 
+DROPBEAR_LOCALOPTIONS_FILE = $(call qstrip,$(BR2_PACKAGE_DROPBEAR_LOCALOPTIONS_FILE))
+ifneq ($(DROPBEAR_LOCALOPTIONS_FILE),)
+define DROPBEAR_APPEND_LOCALOPTIONS_FILE
+       cat $(DROPBEAR_LOCALOPTIONS_FILE) >> $(@D)/localoptions.h
+endef
+DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_APPEND_LOCALOPTIONS_FILE
+endif
+
 define DROPBEAR_INSTALL_TARGET_CMDS
        $(INSTALL) -m 755 $(@D)/dropbearmulti $(TARGET_DIR)/usr/sbin/dropbear
        for f in $(DROPBEAR_TARGET_BINS); do \