Rootfs with explicit version check

Description

This module performs a full rootfs filesystem updates on the device. This is a slightly modified version of the Root Filesystem Image v2 update module. The difference being that this version calls an external script to compare version numbers to ensure older images are not installed.

It supports rollback in the same way as the conventional root filesystem update: rolling back to the old partition on any unforeseen problem. See Mender Architecture documentation to learn more about this design.

The reference implementation of version checking assumes the MENDER_ARTIFACT_NAME field is of the form prefix:number, where prefix is any text. The number is interpreted as a single numeric value and the update is rejected if the new version is less than the currently installed version.

Specification

Module name rootfs-version-check
Supports rollback yes
Requires restart yes
Artifact generation script no
Full system updater yes
Source code Update Module

Prepare the device

This section describes how to setup your target device, i.e. the device to be updated. This will also be referred to as the device environment.

All commands outlined in this section should be run in the device environment.

Prerequisites

This update module has the following prerequisites for the device environment:

This Update Module has the following prerequisites for the development environment:

Install the Update Module

Download the latest version of this Update Module by running:

mkdir -p /usr/share/mender/modules/v3 && wget -P /usr/share/mender/modules/v3 https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/rootfs-version-check/module/rootfs-version-check
chmod +x /usr/share/mender/modules/v3/rootfs-version-check 

Download the latest version of the reference version-check script by running:

mkdir -p /usr/share/mender/utils && wget -P /usr/share/mender/utils https://raw.githubusercontent.com/mendersoftware/mender-update-modules/master/rootfs-version-check/mender-compare-versions
chmod +x /usr/share/mender/utils/mender-compare-versions

Prepare the development environment on your workstation

This section describes how to set up your development environment on your workstation.

All commands outlined in this section should be run in the development environment.

Prerequisites

This Update Modules has the following prerequisites for the development environment:

Create Mender Artifacts

The Artifact can be generated using mender-artifact tool. To generate a rootfs-version-check Update Module Mender Artifact, you can use command:

ARTIFACT_NAME="my-update-1.0"
DEVICE_TYPE="my-device-type"
OUTPUT_PATH="my-update-1.0.mender"
IMAGE="rootfs.ext4"
mender-artifact write module-image -T rootfs-version-check -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -o ${OUTPUT_PATH} -f ${IMAGE}
  • ARTIFACT_NAME - The name of the Mender Artifact
  • DEVICE_TYPE - The compatible device type of this Mender Artifact
  • OUTPUT_PATH - The path where to place the output Mender Artifact. This should always have a .mender suffix
  • IMAGE - The path to the rootfs image to be packaged in the Artifact

You can either deploy this Artifact in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client only in Standalone deployments.

Artifact technical details

The Mender Artifact used by this Update Module has the root filesystem image as the only payload.

The Mender Artifact contents will look like:

Mender artifact:
  Name: my-update-1.0
  Format: mender
  Version: 3
  Signature: no signature
  Compatible devices: '[my-device-type]'
  Provides group: 
  Depends on one of artifact(s): []
  Depends on one of group(s): []
  State scripts:

Updates:
    0:
    Type:   rootfs-version-check
    Provides: Nothing
    Depends: Nothing
    Metadata: Nothing
    Files:
      name:     rootfs.ext4
      size:     0
      modified: 2019-04-15 11:59:24 +0200 CEST
      checksum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
1 Like