#!/bin/bash

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

mkdir -p ~/.local/share/applications/

cd "$SCRIPTDIR"
sed 's#@PATH@#'"$SCRIPTDIR"'#g' GateClient.desktop.in > GateClient.desktop
chmod +x GateClient.desktop
rm -f ~/.local/share/applications/GateClient.desktop
rm -f ~/.local/share/applications/IPdivaClient.desktop
ln -s "$(readlink -f GateClient.desktop)" ~/.local/share/applications/
xdg-mime default GateClient.desktop x-scheme-handler/ipdiva
update-desktop-database ~/.local/share/applications/
echo "Done"
