Skip to content

Package management

Over-the-air package updates

This function is based on a package manager. It allows to define package updates to the devices coming from the repositories defined for the device.

Currently we support Debian packages with others coming soon.

If you want to install and update your own packages you would need "software management". There you can install and update from file manager.

Update all or specific packages

The UI is described in the configuration UI.

The options here are to do a full upgrade of all packages or define single packages. For most customers we recommend to use the single package update. Here as many packages as needed can be defined. Just using the package name will update to latest, defining a version will peg the package to that specific version. This is highly recommended.

Please note that the inventory tab will show any available updates for any library.

Update with pre-condition

Precondition checks if a script/executable exits successfully with "exit=0". Only then the update is performed on the remote edge device. A simple form of doing this is to use /bin/true which always returns 0 and thus always updates. The idea here is that more complicated conditions can be evaluated. For example time slots can be checked (only upgrade at night) and machine conditions can be checked by querying a physical pin or certain environmental variables. These might even be set by a local software or through a UI.

Examples of pre-conditions

Typical pre-conditions to compute are these:

  • check for time and/or date

  • check for physical ports/buttons

  • check if certain applications run

  • check if a file or environment variable exists - for example "update-me"

  • check with an external system if update should be performed (for example with curl)

The pre-condition script is played out with file distribution as follows:

  1. Upload the script to the file manager. Please note the path.

  2. Go to "Configure" and select "File Distribution".

    Make sure the right entity is in scope

  3. Start the actual file distribution definition:

    File Source:

    update-window-check.sh
    

    File Destination:

    /usr/local/bin/update-window-check.sh
    
  4. In order to do anything with the script the optional "Command to run" function can be used. Here commands can be chained using "&&" and this opens up for a lot of complex options. In this case we only do one simple operation:

    Make the script user executable and suppress output:

    chmod 755 /usr/local/bin/update-window-check.sh > /dev/null 2>&1 &
    
  5. Now the script is distributed and can be used in the pre-condition of package management. As a last step we need to insert the correct path into the precondition such that the script will be called when package management is run:

    Pre-condition for package management

Here are some script ideas that can be used to develop custom solutions:

Pre-condition - check for variable "update"

The following script checks if an environmental variable "update" is set to "1". If true the update starts, otherwise it will not run. This can be used to set this variable from a webserver or C++ application on the device (assuming it has a UI). So users can flag when they see a good window for an update period. For example a machine user knows the machine is turned off.

#!/usr/bin/env bash

CheckNamekEnv="update"
CheckVarEnv="1"

VarEnv=`printenv $CheckNamekEnv`

if [ -n "$VarEnv" ]; then
        echo $CheckNamekEnv exist
        exit 0

        if [ "$VarEnv" == "$CheckVarEnv" ]; then
            echo $CheckNamekEnv = OK
        else
            echo $CheckNamekEnv = FAIL
            exit 2
        fi
else
        echo $CheckNamekEnv not exist
        exit 1
fi

Pre-condition - check for time window

The next script checks for a time window and only kicks off potential updates between that time period:

#!/usr/bin/env bash

currenttime=$(date +%H:%M)
   if [[ "$currenttime" > "23:00" ]] || [[ "$currenttime" < "04:30" ]]; then
     exit 0
   else
     exit 1
   fi

Pre-condition - check for date

Another example updates once a month on the 28th day:

#!/usr/bin/env bash

DAY=$(date -d "$D" '+%d')
   if [[ "$DAY" == "28" ]]; then
     exit 0
   else
     exit 1
   fi

Controlling updates "manually"

Of course, it is also possible to control updates through the "enable setting". If a group of devices should only update at a specific point in time the package management bundle can be enabled and after a certain time, when all devices have received the update this can be disabled again.