From 127c512f844cd44bda60d023119aa7ece0c345b2 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sun, 8 Sep 2013 22:10:25 +0200 Subject: [PATCH] call systemctl in subshell to prevent the explorer from failing if it exits non zero Signed-off-by: Steven Armstrong --- cdist/conf/type/__start_on_boot/explorer/state | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cdist/conf/type/__start_on_boot/explorer/state b/cdist/conf/type/__start_on_boot/explorer/state index b156fc82..4e0c82c2 100755 --- a/cdist/conf/type/__start_on_boot/explorer/state +++ b/cdist/conf/type/__start_on_boot/explorer/state @@ -28,14 +28,9 @@ name="$__object_id" case "$os" in archlinux) - # convert bash array to shell - systemctl is-enabled "$name" >/dev/null 2>&1; ret=$? - - if [ "$ret" = 0 ]; then - state="present" - else - state="absent" - fi + state=$(systemctl is-enabled "$name" >/dev/null 2>&1 \ + && echo present \ + || echo absent) ;; debian|ubuntu|openwrt) @@ -48,7 +43,7 @@ case "$os" in [ "$state" ] || state="present" ;; - *) + *) echo "Unsupported os: $os" >&2 exit 1 ;;