#!/bin/sh

# Set up the monitor daemon to autostart
AUTOSTART_DIR="$SNAP_USER_DATA/.config/autostart"
AUTOSTART_FILE="$SNAP/etc/xdg/autostart/org.gnome.DejaDup.Monitor.desktop"
mkdir -p "$AUTOSTART_DIR"
cp --update "$AUTOSTART_FILE" "$AUTOSTART_DIR"

# Without this line we don't seem to properly watch dconf changes.
# The snap default is this dir, plus a "snap.deja-dup" directory.
export XDG_RUNTIME_DIR="/run/user/$(id -u)"

export DEJA_DUP_MONITOR_EXEC="/snap/bin/deja-dup.monitor"
exec "$SNAP/bin/deja-dup" "$@"