xref: /openbmc/openbmc/meta-security/recipes-ids/samhain/files/0006-configure-add-option-for-ps.patch (revision eaae0b339f806200d8722cb09e5e3b83c15a5956)
1*eaae0b33SPatrick WilliamsFrom 2a33032ee97be5015101d94b333244e6fc53840c Mon Sep 17 00:00:00 2001
2*eaae0b33SPatrick WilliamsFrom: Jackie Huang <jackie.huang@windriver.com>
3*eaae0b33SPatrick WilliamsDate: Mon, 18 Jan 2016 00:24:57 -0500
4*eaae0b33SPatrick WilliamsSubject: [PATCH] configure: add option for ps
5*eaae0b33SPatrick Williams
6*eaae0b33SPatrick WilliamsThe configure searches hardcoded host paths for PSPATH
7*eaae0b33SPatrick Williamsand run ps commands to decide PSARG which will fail
8*eaae0b33SPatrick Williamson host without ps:
9*eaae0b33SPatrick Williams| configure: error: Cannot find ps in any of /usr/ucb /bin /usr/bin
10*eaae0b33SPatrick Williams
11*eaae0b33SPatrick WilliamsSo add an option so we can specify the ps at configure
12*eaae0b33SPatrick Williamsto avoid host contamination.
13*eaae0b33SPatrick Williams
14*eaae0b33SPatrick WilliamsUpstream-Status: Inappropriate [cross compile specific]
15*eaae0b33SPatrick Williams
16*eaae0b33SPatrick WilliamsSigned-off-by: Jackie Huang <jackie.huang@windriver.com>
17*eaae0b33SPatrick Williams[AK: refactored for 4.4.3]
18*eaae0b33SPatrick WilliamsSigned-off-by: Armin Kuster <akuster808@gmail.com>
19*eaae0b33SPatrick WilliamsRefresh to 4.5.2
20*eaae0b33SPatrick WilliamsSigned-off-by: Yi Zhao <yi.zhao@windriver.com>
21*eaae0b33SPatrick Williams---
22*eaae0b33SPatrick Williams acinclude.m4 |  2 +-
23*eaae0b33SPatrick Williams configure.ac | 60 +++++++++-------------------------------------------
24*eaae0b33SPatrick Williams 2 files changed, 11 insertions(+), 51 deletions(-)
25*eaae0b33SPatrick Williams
26*eaae0b33SPatrick Williamsdiff --git a/acinclude.m4 b/acinclude.m4
27*eaae0b33SPatrick Williamsindex def24be..e2a57e2 100644
28*eaae0b33SPatrick Williams--- a/acinclude.m4
29*eaae0b33SPatrick Williams+++ b/acinclude.m4
30*eaae0b33SPatrick Williams@@ -359,7 +359,7 @@ x_includes=NONE
31*eaae0b33SPatrick Williams x_libraries=NONE
32*eaae0b33SPatrick Williams DESTDIR=
33*eaae0b33SPatrick Williams SH_ENABLE_OPTS="selinux posix-acl asm ssp db-reload xml-log message-queue login-watch process-check port-check mounts-check logfile-monitor userfiles debug ptrace static network udp nocl stealth micro-stealth install-name identity khide suidcheck base largefile mail external-scripts encrypt srp dnmalloc ipv6 shellexpand suid"
34*eaae0b33SPatrick Williams-SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver signify pubkey-checksum gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
35*eaae0b33SPatrick Williams+SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver signify pubkey-checksum gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file ps-path"
36*eaae0b33SPatrick Williams
37*eaae0b33SPatrick Williams # Installation directory options.
38*eaae0b33SPatrick Williams # These are left unexpanded so users can "make install exec_prefix=/foo"
39*eaae0b33SPatrick Williamsdiff --git a/configure.ac b/configure.ac
40*eaae0b33SPatrick Williamsindex f59754c..d0e3657 100644
41*eaae0b33SPatrick Williams--- a/configure.ac
42*eaae0b33SPatrick Williams+++ b/configure.ac
43*eaae0b33SPatrick Williams@@ -799,56 +799,16 @@ then
44*eaae0b33SPatrick Williams fi
45*eaae0b33SPatrick Williams AC_CHECK_HEADERS(gmp.h)
46*eaae0b33SPatrick Williams
47*eaae0b33SPatrick Williams-AC_MSG_CHECKING([for ps])
48*eaae0b33SPatrick Williams-PS=
49*eaae0b33SPatrick Williams-for ff in /usr/ucb /bin /usr/bin; do
50*eaae0b33SPatrick Williams-    if test -x "$ff/ps"; then
51*eaae0b33SPatrick Williams-       PS="$ff/ps"
52*eaae0b33SPatrick Williams-       AC_MSG_RESULT([$PS])
53*eaae0b33SPatrick Williams-       break
54*eaae0b33SPatrick Williams-    fi
55*eaae0b33SPatrick Williams-done
56*eaae0b33SPatrick Williams-if test x$PS = x
57*eaae0b33SPatrick Williams-then
58*eaae0b33SPatrick Williams-	AC_MSG_RESULT([no])
59*eaae0b33SPatrick Williams-	AC_MSG_ERROR([Cannot find ps in any of /usr/ucb /bin /usr/bin])
60*eaae0b33SPatrick Williams-fi
61*eaae0b33SPatrick Williams-AC_DEFINE_UNQUOTED([PSPATH], [_("$PS")], [Path to ps executable])
62*eaae0b33SPatrick Williams-
63*eaae0b33SPatrick Williams-AC_MSG_CHECKING([how to use ps])
64*eaae0b33SPatrick Williams-$PS ax >/dev/null 2>&1
65*eaae0b33SPatrick Williams-if test $? -eq 0; then
66*eaae0b33SPatrick Williams-   case "$host_os" in
67*eaae0b33SPatrick Williams-   *openbsd*)
68*eaae0b33SPatrick Williams-   one=`$PS akx | wc -l`
69*eaae0b33SPatrick Williams-   ;;
70*eaae0b33SPatrick Williams-   *)
71*eaae0b33SPatrick Williams-   one=`$PS ax | wc -l`
72*eaae0b33SPatrick Williams-   ;;
73*eaae0b33SPatrick Williams-   esac
74*eaae0b33SPatrick Williams-else
75*eaae0b33SPatrick Williams-   one=0
76*eaae0b33SPatrick Williams-fi
77*eaae0b33SPatrick Williams-$PS -e >/dev/null 2>&1
78*eaae0b33SPatrick Williams-if test $? -eq 0; then
79*eaae0b33SPatrick Williams-   two=`$PS -e | wc -l`
80*eaae0b33SPatrick Williams-else
81*eaae0b33SPatrick Williams-   two=0
82*eaae0b33SPatrick Williams-fi
83*eaae0b33SPatrick Williams-if test $one -ge $two
84*eaae0b33SPatrick Williams-then
85*eaae0b33SPatrick Williams-   case "$host_os" in
86*eaae0b33SPatrick Williams-   *openbsd*)
87*eaae0b33SPatrick Williams-	PSARG="akx"
88*eaae0b33SPatrick Williams-	;;
89*eaae0b33SPatrick Williams-   *)
90*eaae0b33SPatrick Williams-	PSARG="ax"
91*eaae0b33SPatrick Williams-	;;
92*eaae0b33SPatrick Williams-   esac
93*eaae0b33SPatrick Williams-else
94*eaae0b33SPatrick Williams-	PSARG="-e"
95*eaae0b33SPatrick Williams-fi
96*eaae0b33SPatrick Williams-AC_DEFINE_UNQUOTED([PSARG], [_("$PSARG")], [Argument for ps])
97*eaae0b33SPatrick Williams+AC_ARG_WITH(ps-path,
98*eaae0b33SPatrick Williams+	[  --with-ps-path=PATH         set path to ps command ],
99*eaae0b33SPatrick Williams+	[
100*eaae0b33SPatrick Williams+	if test "x${withval}" != xno; then
101*eaae0b33SPatrick Williams+		pspath="${withval}"
102*eaae0b33SPatrick Williams+		AC_DEFINE_UNQUOTED([PSPATH], _("${pspath}"), [Path to ps])
103*eaae0b33SPatrick Williams+		AC_DEFINE_UNQUOTED([PSARG], _("ax"), [Argument for ps])
104*eaae0b33SPatrick Williams+	fi
105*eaae0b33SPatrick Williams+	])
106*eaae0b33SPatrick Williams+
107*eaae0b33SPatrick Williams AC_MSG_RESULT([$PS $PSARG])
108*eaae0b33SPatrick Williams
109*eaae0b33SPatrick Williams dnl *****************************************
110*eaae0b33SPatrick Williams--
111*eaae0b33SPatrick Williams2.34.1
112*eaae0b33SPatrick Williams
113