package/swupdate: add webserver config option
authorJames Hilliard <james.hilliard1@gmail.com>
Sun, 29 Aug 2021 02:46:30 +0000 (20:46 -0600)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Sat, 11 Sep 2021 14:11:47 +0000 (16:11 +0200)
Since the website depends on the webserver being enabled we should
add a config option for it and make the website depend on that.

We should also ensure that the mongoose(webserver) config is present.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
package/swupdate/10-mongoose-args [new file with mode: 0644]
package/swupdate/Config.in
package/swupdate/swupdate.mk

diff --git a/package/swupdate/10-mongoose-args b/package/swupdate/10-mongoose-args
new file mode 100644 (file)
index 0000000..d0b0f8b
--- /dev/null
@@ -0,0 +1 @@
+SWUPDATE_WEBSERVER_ARGS="-r /var/www/swupdate ${SWUPDATE_MONGOOSE_EXTRA_ARGS:--p 8080}"
index f601e45fcd1eaa81f2e1f924d4e71ee6c36ee76b..6b832cfcbf45106218d6b893273a69094eb51141 100644 (file)
@@ -60,9 +60,16 @@ config BR2_PACKAGE_SWUPDATE_CONFIG
          I you wish to use your own modified swupdate configuration
          file specify the config file location with this option.
 
+config BR2_PACKAGE_SWUPDATE_WEBSERVER
+       bool "swupdate webserver"
+       default y
+       help
+         Enable update from remote using a web server on the target.
+
 config BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE
        bool "install default website"
        default y
+       depends on BR2_PACKAGE_SWUPDATE_WEBSERVER
        help
          Install the provided website to /var/www/swupdate.
 
index 256f0930ce29ce9985dadd6572b50cb27e5dd57b..cf3607a66131f6c096d2bf63f5343857991fc959 100644 (file)
@@ -187,6 +187,16 @@ ifeq ($(BR2_PACKAGE_LIBRSYNC),y)
 SWUPDATE_DEPENDENCIES += librsync
 endif
 
+ifeq ($(BR2_PACKAGE_SWUPDATE_WEBSERVER),y)
+define SWUPDATE_SET_WEBSERVER
+       $(call KCONFIG_ENABLE_OPT,CONFIG_WEBSERVER)
+endef
+else
+define SWUPDATE_SET_WEBSERVER
+       $(call KCONFIG_DISABLE_OPT,CONFIG_WEBSERVER)
+endef
+endif
+
 SWUPDATE_BUILD_CONFIG = $(@D)/.config
 
 SWUPDATE_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_SWUPDATE_CONFIG))
@@ -200,6 +210,7 @@ SWUPDATE_MAKE_OPTS = \
 define SWUPDATE_KCONFIG_FIXUP_CMDS
        $(SWUPDATE_SET_LUA_VERSION)
        $(SWUPDATE_SET_SYSTEMD)
+       $(SWUPDATE_SET_WEBSERVER)
 endef
 
 define SWUPDATE_BUILD_CMDS
@@ -229,6 +240,9 @@ define SWUPDATE_INSTALL_COMMON
                $(TARGET_DIR)/usr/lib/swupdate/conf.d
        $(INSTALL) -D -m 755 package/swupdate/swupdate.sh \
                $(TARGET_DIR)/usr/lib/swupdate/swupdate.sh
+       $(if $(BR2_PACKAGE_SWUPDATE_WEBSERVER), \
+               $(INSTALL) -D -m 644 package/swupdate/10-mongoose-args \
+                       $(TARGET_DIR)/usr/lib/swupdate/conf.d/10-mongoose-args)
 endef
 define SWUPDATE_INSTALL_INIT_SYSTEMD
        $(SWUPDATE_INSTALL_COMMON)