Import/Export Config Trees

This topic summarizes how to create a script to automate importing and exporting config tree settings.

Legato currently overwrites private config trees during upgrading. The import/export script is an easy way to create a copy of your config trees so you can reinstate them after installing a new Legato version without rebuilding them.

This code sample shows how you can wrap instapp in a shell script that will automate the import/export functions:

#!/bin/bash
APP_NAME=$1
if [ -z "$APP_NAME" ]
then
>&2 echo "Application name not specified."
exit 1
fi
if [ -z "$2" ]
then
if [ -z "$DEST_IP" ]
then
>&2 echo "Device IP address not specified."
exit 1
fi
DEVICE_IP=$DEST_IP
else
DEVICE_IP=$2
fi
function cfg
{
CMD=$1
#echo "Test: "
ssh root@$DEVICE_IP "/usr/local/bin/config $CMD $APP_NAME:/ ~/$APP_NAME.cfg"
}
cfg export
instapp $APP_NAME.wp85.update $DEVICE_IP
cfg import

If you save this script as inst.sh, you can run like this:

$ inst.sh <myApp> <myDeviceIP>

or

$ export DEST_IP=<myDeviceIP>
$ inst.sh myApp

Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.