#!/bin/bash

if [ ! -d "$HOME"/.config/SEGGER/JLinkDevices ] ; then
    mkdir -p $HOME/.config/SEGGER/JLinkDevices || exit 1
fi

if [ -d "$HOME"/.config/SEGGER/JLinkDevices/AirM2M ] ; then
    rm -rf $HOME/.config/SEGGER/JLinkDevices/AirM2M || exit 1
fi

if [ ! -d "$HOME"/.config/SEGGER/JLinkDevices/AirM2M ] ; then
    cp -r /opt/AirMCU/AirM2M $HOME/.config/SEGGER/JLinkDevices/ || exit 1
fi
