#!/bin/bash
echo "Update post procedures starting"

PID=`pgrep Box.Applications.Synk.Loader`
if [ ! -z $PID ]; then
	kill -9 $PID
else
	echo "process \" Box.Application.Synk.Loader\" not running."
fi

PID=`pgrep Box.Applications.Synk`
if [ ! -z $PID ]; then
	kill -9 $PID
else
	echo "process \" Box.Application.Synk\" not running."
fi

sleep 2

echo "Moving Files"

rm -f "${1}"version.json >/dev/null 2>&1
mv -f "${1}"* "${2}" >/dev/null 2>&1 
rm -rf "${1}" >/dev/null 2>&1

chmod +x "${2}"Box.Applications.Synk
chmod +x "${2}"Box.Applications.Synk.Loader

echo "Update complete"
