#!/bin/bash
cd /
sleep 5
volname=${1}
base=${volname}
echo "start ${base}, ${HOME}" > /tmp/SkyliveUpgrade.log
if [ -f "${HOME}/.SkyLIVE.app" ] ; then
   echo "Removing Old client" >> /tmp/SkyliveUpgrade.log
   rm -rf "${HOME}/.SkyLIVE.app" >> /tmp/SkyliveUpgrade.log 2>&1
fi
cp -r ${base}/skylive-ng.app "${HOME}/.SkyLIVE.app" >> /tmp/SkyliveUpgrade.log 2>&1
#mv "${HOME}/.SkyLIVE.app/Contents/MacOS/skylive-ng.bin" "${HOME}/.SkyLIVE.app/Contents/MacOS/skylive-ng" >> /tmp/SkyliveUpgrade.log 2>&1
hdiutil detach ${volname} >> /tmp/SkyliveUpgrade.log 2>&1
${HOME}/.SkyLIVE.app/Contents/MacOS/skylive-ng &
echo "Launched" >> /tmp/SkyliveUpgrade.log
disown %1
