#!/bin/sh
# JoyRemote - the viewer, and the name on your PATH.
set -e
DEFAULTS=/etc/joyremote/service.json
SETTINGS="${HOME:-/nonexistent}/JoyRemote/JoyRemote"
if [ -r "$DEFAULTS" ] && [ ! -e "$SETTINGS/service.json" ]; then
    if mkdir -p "$SETTINGS" 2>/dev/null; then
        cp "$DEFAULTS" "$SETTINGS/service.json" 2>/dev/null || true
        chmod 600 "$SETTINGS/service.json" 2>/dev/null || true
    fi
fi
exec /opt/joyremote/JoyRemote "$@"
