#!/usr/bin/env sh

## args

if [ $# -ge 1 ] ; then directory=$1 && shift ; else directory="/opt/heimdall" ; fi


## exec

mkdir --parents ${directory}
cp --recursive --update --verbose build/* ${directory}/

mkdir --parents /usr/local/bin/
echo "NODE_PATH=\${NODE_PATH}:${directory} ${directory}/heimdall \$@" > /usr/local/bin/heimdall
chmod +x /usr/local/bin/heimdall

mkdir --parents /usr/local/share/icons/
cp media/icon.png /usr/local/share/icons/heimdall.png
