Blog

Mender 1.2 released: scripting support!

5th Sep 2017

We are happy to announce the production releases of Mender 1.2.0 and Mender 1.1.1!

The Mender 1.1.1 release notes contains the details on the improvements in the Mender 1.1.1 patch release.

The key features of Mender 1.2 are covered below below, and you can see the detailed items in the Mender 1.2.0 release notes.

State scripts

There has beeen a lot of interest in the ability to run pre- and postinstall scripts, before and after the Mender Client writes the root file system.

Mender 1.2 not only includes support for pre- and postinstall scripts, but more generally state scripts. State scripts are more general and useful than pre/postinstall scripts because they can be run between any state transition, not just (before/after) the install state. You can see the nine states supported by in the state script documentation.

Mender users will probably come up with a lot of interesting use cases for state scripts, and we will cover some of them below for inspiration.

Application data migration

In this case, application data like a user profile is stored in an SQLite database and a new column need to be added before starting the new version of the application. This can be achieved by adding a state script to ArtifactReboot_Enter (that would run after writing the new rootfs, but before rebooting). This script can then do the neccessary migrations on the data partition before the new version of the application is brought up after the reboot.

Update confirmation by end user

For many devices with a display that interacts with an end user, it is desirable to ask the user before applying the update. You have probably seen this on a smartphone, where it will ask you if you want to update to the latest release of Android or iOS and it only starts after you hit "Apply".

Mender state scripts enable this use case with a script written to create the dialog box on the UI framework used. The script will simply wait for user input, and Mender will wait with the update process while waiting for the script to finish. Depending on what the user selects, the script can return 0 (proceed) or 1 (stop). This script can be run in the Download_Enter state, for example.

Make sure to increase the default timeout for state scripts to enable this use case.

Custom sanity checks

Mender already automatically rolls back an update if it can not reach the Mender Server after the update is applied, in order to ensure another update can be deployed.

In addition, scripts in ArtifactCommit_Enter can do additional sanity checks to make sure that the device and applications are working as expected. For example, is the UI application running and responding before a certain time has passed? If not, then the script can simply return 1 and Mender will roll back the update.

Enable network connectivity

In order to save power and bandwidth, network connectivity may not be enabled by default on the device, so you want to selectively enable it when needed.

A state scripts in Sync_Enter can enable network connectivity, optionally also in Reboot_Leave if network connectivity is not enabled directly following a reboot.

Using state scripts

We hope this has given you a taste of what can be achieved with state scripts, head over to the state script documentation for a more in-depth description and how to get started!

Raw flash support

Many Mender users have reached out and asked for support for raw flash - so they could use Mender on their raw flash devices. We are very happy to introduce official support for raw flash in Mender 1.2 - both NAND flash and SPI-NOR flash devices are supported!

To clarify what is meant by raw flash, take a look at the Flash memory types section.

During this process two more boards were added as reference boards for Mender, thus fully integrated with the CI system and supported:

To get started with your raw flash device, take a look at the Raw flash integration documentation.

Remove Artifact from UI

The Mender UI now has a button to remove uploaded Artifacts, in case you uploaded one by mistake or need to clean up. This has been available on the API-level since Mender 1.0, and is now introduced in the UI to simplify Artifact management.

Remove Artifact

Try Mender 1.2

The documentation has a new 1.2 section that includes all the resources you need to get going. To test the new features, you can start with these pages:

Upgrading Mender 1.1 production installations

If you are using Mender 1.1, follow the Mender 1.2 upgrade documentation to get the new features!

It will likely work to use the same document to upgrade older releases of Mender as well, but please note that the official and tested upgrade path is always from the previous release (i.e. a 1.1.x release in this case).

Support for your board

If you are getting started with OTA updates or do not have time to integrate the Mender client with your board, we are happy to help with professional services to enable Mender support for your board!

Share your feedback

We are happy to continue to see your general feedback on Mender, be it positive or need for improvement. Take a look at the Mender community page for ways to connect with the Mender community. Your continued feedback ensures Mender will meet your needs even better in the future!

If you believe you have encoutered a bug, please submit your report at the Mender JIRA issue tracker.

We hope you enjoy the new features and are looking forward to hearing from you!