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
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# 2016 Daniel Heule (hda at sfs.biz)
# Copyright 2017, Philippe Gregoire <pg@pgregoire.xyz>
#
# 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
;;
*)