swupdate: customization of default website path
cover swupdate: customization of default website path
This patch allows for customization of the destination directory of the swupdate default webserver static files. Some configurations use a read-only rootfs and have a tmpfs mounted on /var so /var/www/swupdate is not an option for those systems. The newly added option allows users to install the website files in somewhere more stable like a subdirectory of /usr/share/swupdate or /usr/share/factory in the case of a volatile /var.
The previous fixed value of /var/www/swupdate is preserved as the default so this change shouldn't disturb any existing configurations.
Jordan Yelloz (2):
swupdate: allowed website install path
swupdate: updated help of INSTALL_WEBSITE config
package/swupdate/Config.in | 22 ++++++++++++++++++---- package/swupdate/swupdate.mk | 11 ++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-)
Signature · 1 line
2.9.0
PATCH 1/2 swupdate: allowed website install path
Some systems run on an empty /var tmpfs and would prefer the website data installed in /usr/share/swupdate/www or something similar so this allows the website data to go somewhere else. The default location of /var/www/swupdate is preserved.
--- package/swupdate/Config.in | 9 +++++++++ package/swupdate/swupdate.mk | 11 ++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-)
package/swupdate/Config.in +9 -0
@@ -51,6 +51,15 @@ config BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE This is necessary if you want to run swupdate with the embedded webserver and do not provide an own website to be installed to /var/www/swupdate. + +if BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE + +config BR2_PACKAGE_SWUPDATE_WEBSITE_PATH + string "location of swupdate website data" + default "/var/www/swupdate" + +endif + endif comment "swupdate needs a toolchain w/ threads"
package/swupdate/swupdate.mk +8 -3
@@ -114,11 +114,16 @@ endef define SWUPDATE_INSTALL_TARGET_CMDS $(INSTALL) -D -m 0755 $(@D)/swupdate $(TARGET_DIR)/usr/bin/swupdate - $(if $(BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE), \ - mkdir -p $(TARGET_DIR)/var/www/swupdate; \ - cp -dpf $(@D)/www/* $(TARGET_DIR)/var/www/swupdate) + $(SWUPDATE_INSTALL_TARGET_WEBSITE_CMDS) endef +ifeq ($(BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE),y) +define SWUPDATE_INSTALL_TARGET_WEBSITE_CMDS + $(INSTALL) -d -m 0755 $(TARGET_DIR)$(BR2_PACKAGE_SWUPDATE_WEBSITE_PATH) + $(INSTALL) -m 0644 $(@D)/www/* $(TARGET_DIR)$(BR2_PACKAGE_SWUPDATE_WEBSITE_PATH) +endef +endif + # Checks to give errors that the user can understand # Must be before we call to kconfig-package ifeq ($(BR2_PACKAGE_SWUPDATE)$(BR_BUILDING),yy)
Signature · 1 line
2.9.0
PATCH 2/2 swupdate: updated help of INSTALL_WEBSITE config
In reply to Jordan YellozSome explanation was added about how to use the new configuration option and how to properly run the swupdate website using the package-installed website data.
--- package/swupdate/Config.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
package/swupdate/Config.in +9 -4
@@ -46,11 +46,16 @@ config BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE bool "install default website" default y help - Install the provided website to /var/www/swupdate. + Install the provided website. - This is necessary if you want to run swupdate with the embedded - webserver and do not provide an own website to be installed to - /var/www/swupdate. + This is necessary if you want to run swupdate with the embedded webserver + and do not provide a custom website to be installed in your rootfs. + + You can customize the installation path of the static website data with + the symbol BR2_PACKAGE_SWUPDATE_WEBSITE_PATH and add that as an option to + the mongoose server when running swupdate using an invocation similar to: + + swupdate -w '-document_root /var/www/swupdate' if BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE
Signature · 1 line
2.9.0
cover swupdate: customization of default website path
In reply to Jordan YellozHello,
Quoted 9 lines · Jordan Yelloz
This patch allows for customization of the destination directory of the swupdate default webserver static files. Some configurations use a read-only rootfs and have a tmpfs mounted on /var so
/var/www/swupdateis not an option for those systems. The newly added option allows users to install the website files in somewhere more stable like a subdirectory of/usr/share/swupdateor/usr/share/factoryin the case of a volatile /var.The previous fixed value of
/var/www/swupdateis preserved as the default so this change shouldn't disturb any existing configurations.
Thanks for your proposal. However, it's Buildroot's policy to install all the web-related stuff in /var/www. Nothing prevents you from moving things around in a post-build script, and I think that's what we would recommend in your situation.
Look at all the jquery* packages, the bootstrap package, and many more packages. We can't add an option for all of them, so we prefer to install in a default location that is somewhat sane, and leave it to post-build scripts to move things around if needed.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com