diff options
author | David Runge <dave@sleepmap.de> | 2022-04-20 12:55:19 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2022-04-20 12:55:19 +0200 |
commit | 9cd02d6c59212377da39121666e8471a39be22c0 (patch) | |
tree | 2d459f37a5964d2c9e4aad9e943782aa26591910 /.zprofile | |
parent | 80d46a089c754aa6023a2688803a878762d37bea (diff) | |
download | dotfiles-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-- | .zprofile | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |