
DAEMON_DESTINATION="/Library/LaunchDaemons/{{serviceName}}.plist"
PREFPANE_DESTINATION="/Library/PreferencePanes/{{displayName}}.prefPane"
if /bin/launchctl list "{{serviceName}}" &> /dev/null; then
    echo "Unloading previous service"
    /bin/launchctl unload "$DAEMON_DESTINATION"
fi

if test -e "$DAEMON_DESTINATION"; then
    echo "Removing previous service file"
    rm "$DAEMON_DESTINATION"
fi

if test -e "$PREFPANE_DESTINATION"; then
    echo "Removing previous preferences link"
    rm "$PREFPANE_DESTINATION"
fi
