#############################################
#                                           #
#   Installation of FieldbusAccess          #
#                                           #
#   2016-08-31 Maximatecc                   #
#   Daniel Nisses-Gagnér                    #
#                                           #
#############################################

#!/bin/sh

VERSION=$1

echo "Installing FieldbusAccess runtime on unit"

# If Configuration file exists, dont overwrite!
if [ -e /opt/bin/FieldbusAccess_ConfigFile.json ]; then
	cp -d /opt/bin/FieldbusAccess_ConfigFile.json /opt/bin/FieldbusAccess_ConfigFile.json.installtmp
        tar -xf fieldbusAccess_arm.1.2.2.62.tar.gz -C /
        mv /opt/bin/FieldbusAccess_ConfigFile.json.installtmp /opt/bin/FieldbusAccess_ConfigFile.json
else
	tar -xf fieldbusAccess_arm.1.2.2.62.tar.gz -C /
fi

chmod +x /opt/etc/init.d/StartupFieldbusAccess

ldconfig -C /opt/etc/ld.so.cache

touch /opt/packages/FieldbusAccess_ARM_runtime_1.2.2.62

echo "Installation complete"

