use sudo to run actions with a different user, check for subshell
This commit is contained in:
parent
82d32ec30a
commit
6be503b700
3 changed files with 7 additions and 4 deletions
|
@ -3,8 +3,8 @@
|
|||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# 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"))"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# 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"
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
# define user
|
||||
export RESTIC_USER="restic"
|
||||
|
||||
# override default repository
|
||||
export RESTIC_REPOSITORY="/mnt/restic"
|
||||
|
||||
|
|
Loading…
Reference in a new issue