Timezone

Description

The timezone apply-device-config script sets the device’s timezone using the value of the timezone key from the Device Configuration.

Specification

Script name timezone
Configuration key(s) evaluated timezone
Version 1.0.0
Source code Script
Maintainer Northern.tech

Please be aware that Mender apply-device-config scripts are meant to update and configure parts of the system and if not configured properly they could potentially delete parts or the complete system. Always inspect the code carefully and only test scripts on systems that you can recover easily.

Prepare the device

This section describes how to setup your target device, i.e. the device to be configured. 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 apply-device-config script has the following prerequisites for the device environment:

Install the apply-device-config script

Debian family

The timezone apply-device-config script is available in the Mender APT repository. Follow instructions in Mender Docs to install the repository in your device. Then, install mender-configure-timezone with:

sudo apt-get update
sudo apt-get install mender-configure-timezone

From source

Alternatively to all the above, it is possible to install from source. Follow these steps:

mkdir -p /usr/lib/mender-configure/apply-device-config.d && wget -P /usr/lib/mender-configure/apply-device-config.d https://raw.githubusercontent.com/mendersoftware/mender-configure-module/1.0.0/scripts/timezone && chmod +x /usr/lib/mender-configure/apply-device-config.d/timezone

Usage

You can now set the device’s timezone setting the timezone configuration key in the Device Configuration.

While all values from timedatectl list-timezones will work, to easily see the impact of the changed value you can use one of the following values:

  • Europe/Oslo
  • America/Los_Angeles
  • Asia/Tokyo

Once the configuration has been applied you can see the effect by connecting to the Device’s terminal, either via SSH or using the Remote Terminal, and executing the date command.