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.
This commit is contained in:
Philippe Grégoire 2017-08-20 11:06:07 -04:00
parent ceb97fd0ee
commit 5646a66f6c
No known key found for this signature in database
GPG key ID: A14AA6DA679C2177

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# 2016 Daniel Heule (hda at sfs.biz) # 2016 Daniel Heule (hda at sfs.biz)
# Copyright 2017, Philippe Gregoire <pg@pgregoire.xyz>
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -25,7 +26,10 @@
uname_s="$(uname -s)" uname_s="$(uname -s)"
case "$uname_s" in case "$uname_s" in
Linux|FreeBSD) Linux)
pgrep -P0 -l | awk '/^1[ \t]/ {print $2;}'
;;
FreeBSD)
ps -o comm= -p 1 || true ps -o comm= -p 1 || true
;; ;;
*) *)