package/mender: add support for update modules
authorAdam Duskett <Aduskett@gmail.com>
Wed, 15 Jul 2020 17:37:07 +0000 (10:37 -0700)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Wed, 15 Jul 2020 21:46:40 +0000 (23:46 +0200)
Mender has support for performing other types of updates other than
just overwriting the rootfs partition that isn't currently in use on
the target.

Some of the default provided modules provide support for:
  - Updating a docker container.
  - Running a script.
  - Installing an RPM.
  - Overwriting a directory.
  - Updating a single-file.

The single-file update module is used by upstream for onboarding a new
device to a server, and this fails with Buildroot devices because the
modules are currently not installed.

Install the directory, script, and single-file modules by default, and
install the docker or rpm script if their respective packages are
selected.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/mender/mender.mk

index 2faf3fe9805af3038b841bbf90457e1c2df389d6..13f0225037d0b6ca695242ba425adfcd7c7600d7 100644 (file)
@@ -37,6 +37,13 @@ MENDER_DEPENDENCIES = xz
 
 MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)
 
+MENDER_UPDATE_MODULES_FILES = \
+       directory \
+       script \
+       single-file
+       $(if $(BR2_PACKAGE_DOCKER_CLI),docker) \
+       $(if $(BR2_PACKAGE_RPM),rpm)
+
 define MENDER_INSTALL_CONFIG_FILES
        $(INSTALL) -d -m 755 $(TARGET_DIR)/etc/mender/scripts
        echo -n "3" > $(TARGET_DIR)/etc/mender/scripts/version
@@ -61,6 +68,10 @@ define MENDER_INSTALL_CONFIG_FILES
 
        mkdir -p $(TARGET_DIR)/var/lib
        ln -snf /var/run/mender $(TARGET_DIR)/var/lib/mender
+       $(foreach f,$(MENDER_UPDATE_MODULES_FILES), \
+               $(INSTALL) -D -m 0755 $(@D)/support/modules/$(notdir $(f)) \
+                       $(TARGET_DIR)/usr/share/mender/modules/v3/$(notdir $(f))
+       )
 endef
 
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES