aboutsummaryrefslogtreecommitdiffstats
path: root/.zprofile
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2022-04-20 12:55:19 +0200
committerDavid Runge <dave@sleepmap.de>2022-04-20 12:55:19 +0200
commit9cd02d6c59212377da39121666e8471a39be22c0 (patch)
tree2d459f37a5964d2c9e4aad9e943782aa26591910 /.zprofile
parent80d46a089c754aa6023a2688803a878762d37bea (diff)
downloaddotfiles-9cd02d6c59212377da39121666e8471a39be22c0.tar.gz
dotfiles-9cd02d6c59212377da39121666e8471a39be22c0.tar.bz2
dotfiles-9cd02d6c59212377da39121666e8471a39be22c0.tar.xz
dotfiles-9cd02d6c59212377da39121666e8471a39be22c0.zip
zsh: Only execute systemctl on systems providing it
.zprofile: Guard execution of systemctl with a check for existence using `command -v`.
Diffstat (limited to '.zprofile')
-rw-r--r--.zprofile12
1 files changed, 7 insertions, 5 deletions
diff --git a/.zprofile b/.zprofile
index 3a4ed26..4ec678f 100644
--- a/.zprofile
+++ b/.zprofile
@@ -41,9 +41,11 @@ fi
[[ "$TTY" == /dev/tty* ]] || return 0
-export $(systemctl --user show-environment)
-if [[ -z $DISPLAY && "$TTY" == "/dev/tty1" ]]; then
- systemd-cat -t sway sway
- systemctl --user stop sway-session.target
- systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
+if command -v systemctl > /dev/null; then
+ export $(systemctl --user show-environment)
+ if [[ -z $DISPLAY && "$TTY" == "/dev/tty1" ]]; then
+ systemd-cat -t sway sway
+ systemctl --user stop sway-session.target
+ systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
+ fi
fi