diff --git a/scripts/restic/backup.sh b/scripts/restic/backup.sh index 451a66e..a0fd25e 100755 --- a/scripts/restic/backup.sh +++ b/scripts/restic/backup.sh @@ -3,8 +3,8 @@ # author: Daniel Sommer # license: MIT -# check permissions -[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1 +# check if we're running in a subshell, forbid direct execution +[[ "$ZSH_EVAL_CONTEXT" == "toplevel" ]] && printf "error: direct execution of this script is forbidden!\n" >&2 && exit 1 # get the "home" directory home="$(dirname $(realpath "$0"))" diff --git a/scripts/restic/prune.sh b/scripts/restic/prune.sh index 15e7686..0c666ac 100755 --- a/scripts/restic/prune.sh +++ b/scripts/restic/prune.sh @@ -3,8 +3,8 @@ # author: Daniel Sommer # license: MIT -# check permissions -[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1 +# check if we're running in a subshell, forbid direct execution +[[ "$ZSH_EVAL_CONTEXT" == "toplevel" ]] && printf "error: direct execution of this script is forbidden!\n" >&2 && exit 1 # define title and icon for the notification export RESTIC_NTFY_TITLE="prune" diff --git a/scripts/restic/restic.env b/scripts/restic/restic.env index 7a89e5e..06f73b8 100644 --- a/scripts/restic/restic.env +++ b/scripts/restic/restic.env @@ -3,6 +3,9 @@ # author: Daniel Sommer # license: MIT +# define user +export RESTIC_USER="restic" + # override default repository export RESTIC_REPOSITORY="/mnt/restic"