#!/usr/bin/env bash
set -e
export GRPDIR=/tmp/hedgewars
if [[ ! -e $GRPDIR/bin ]]; then
    mkdir -p $GRPDIR
    echo "Mounting..."
    sshfs -o reconnect grp@klaxon.hacksoc.org:hedgewars/ $GRPDIR
    echo "Mounted ok."
fi
export PATH=$GRPDIR/bin:$PATH
export LD_LIBRARY_PATH=$GRPDIR/lib:$LD_LIBRARY_PATH

hedgewars $@

fusermount -u $GRPDIR
rmdir $GRPDIR
unset GRPDIR
