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>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
# check permissions
|
# check if we're running in a subshell, forbid direct execution
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
|
[[ "$ZSH_EVAL_CONTEXT" == "toplevel" ]] && printf "error: direct execution of this script is forbidden!\n" >&2 && exit 1
|
||||||
|
|
||||||
# get the "home" directory
|
# get the "home" directory
|
||||||
home="$(dirname $(realpath "$0"))"
|
home="$(dirname $(realpath "$0"))"
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
# check permissions
|
# check if we're running in a subshell, forbid direct execution
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
|
[[ "$ZSH_EVAL_CONTEXT" == "toplevel" ]] && printf "error: direct execution of this script is forbidden!\n" >&2 && exit 1
|
||||||
|
|
||||||
# define title and icon for the notification
|
# define title and icon for the notification
|
||||||
export RESTIC_NTFY_TITLE="prune"
|
export RESTIC_NTFY_TITLE="prune"
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
|
# define user
|
||||||
|
export RESTIC_USER="restic"
|
||||||
|
|
||||||
# override default repository
|
# override default repository
|
||||||
export RESTIC_REPOSITORY="/mnt/restic"
|
export RESTIC_REPOSITORY="/mnt/restic"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue