#!/bin/sh

if [ -d "~/.marsnomercy" ]; then
        cd ~/.marsomercy || exit 1
        exec /usr/local/libexec/mars "$@"
else
        cd /usr/local/share/marsnomercy || exit 1
        find * -type d -exec mkdir -p ~/.marsnomercy/data/{} \; || exit 1
        find * -type f -exec ln -s /usr/local/share/marsnomercy/{} ~/.marsnomercy/data/{} \; 2>/dev/null || exit 1
        cd ~/.marsnomercy || exit 1
        exec /usr/local/libexec/mars "$@"
fi
