From 9cd02d6c59212377da39121666e8471a39be22c0 Mon Sep 17 00:00:00 2001 From: David Runge Date: Wed, 20 Apr 2022 12:55:19 +0200 Subject: zsh: Only execute systemctl on systems providing it .zprofile: Guard execution of systemctl with a check for existence using `command -v`. --- .zprofile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to '.zprofile') 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 -- cgit v1.2.3-70-g09d2