From 5646a66f6c6b5f5dd66f69d63709825af9e99a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Gr=C3=A9goire?= Date: Sun, 20 Aug 2017 11:06:07 -0400 Subject: [PATCH 1/2] explorer/init/Linux: replace ps by pgrep BusyBox's version of ps does not support the -o option. On Linux systems, use pgrep -P0 -l to get the name of pid 1. --- cdist/conf/explorer/init | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cdist/conf/explorer/init b/cdist/conf/explorer/init index 2693a0d3..54784a2e 100755 --- a/cdist/conf/explorer/init +++ b/cdist/conf/explorer/init @@ -1,6 +1,7 @@ #!/bin/sh # # 2016 Daniel Heule (hda at sfs.biz) +# Copyright 2017, Philippe Gregoire # # This file is part of cdist. # @@ -25,7 +26,10 @@ uname_s="$(uname -s)" case "$uname_s" in - Linux|FreeBSD) + Linux) + pgrep -P0 -l | awk '/^1[ \t]/ {print $2;}' + ;; + FreeBSD) ps -o comm= -p 1 || true ;; *) From ebe0c0d66df5b2a10bedb0b4ccbaa5975da96b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Gr=C3=A9goire?= Date: Sun, 20 Aug 2017 11:12:30 -0400 Subject: [PATCH 2/2] make sure we continue on errors --- cdist/conf/explorer/init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/explorer/init b/cdist/conf/explorer/init index 54784a2e..43a66a50 100755 --- a/cdist/conf/explorer/init +++ b/cdist/conf/explorer/init @@ -27,7 +27,7 @@ uname_s="$(uname -s)" case "$uname_s" in Linux) - pgrep -P0 -l | awk '/^1[ \t]/ {print $2;}' + (pgrep -P0 -l | awk '/^1[ \t]/ {print $2;}') || true ;; FreeBSD) ps -o comm= -p 1 || true