aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/ipmiutil/ipmiutil/fix_systemd_path.patch
blob: 2fa7c6883dd29f5aaf89ff182e6b5bc9997c912f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
allow systemd path to be defined by configure option.

The configure probes the host for systemd path information.

Upstream Status: Inappropriate [Embedded]

Signed-off-By: Armin Kuster <akuster@mvista.com>

Index: ipmiutil-2.9.6/configure
===================================================================
--- ipmiutil-2.9.6.orig/configure
+++ ipmiutil-2.9.6/configure
@@ -792,7 +792,6 @@ LTLIBOBJS
 LIBOBJS
 pkgconfigdir
 SHR_LINK
-SYSTEMD_DIR
 CROSS_LFLAGS
 CROSS_CFLAGS
 SUBDIR_S
@@ -999,7 +998,7 @@ psdir='${docdir}'
 libdir='${exec_prefix}/lib'
 localedir='${datarootdir}/locale'
 mandir='${datarootdir}/man'
-
+systemddir='${datarootdir}/ipmiutil'
 ac_prev=
 ac_dashdash=
 for ac_option
@@ -1594,7 +1593,10 @@ Optional Features:
   --enable-standalone    build standalone, with no GPL or LanPlus libs.
   --enable-libsensors	 build libipmiutil with sensor modules [default=no]
   --enable-gpl           build with some GPL code [default=no]
-  --enable-systemd       enable systemd service type=notify support and %_unitdir [default=disabled]
+  --enable-systemd[=systemddir]      install systemd unit file.  If 'yes'
+                probe the system for unit directory.
+                If a path is specified, assume that
+                is a valid install path.  [default=disabled]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -12980,7 +12982,6 @@ CROSS_LFLAGS=""
 CROSS_CFLAGS=""
 LIBSENSORS=""
 SAM2OBJ="isensor2.o ievents2.o"
-SYSTEMD_DIR=/usr/share/ipmiutil
 
 # Check whether --enable-useflags was given.
 if test "${enable_useflags+set}" = set; then
@@ -13032,31 +13033,43 @@ if test "${enable_gpl+set}" = set; then
     fi
 
 fi
-
+#
+# Check for systemd unit files direectory exists if unit file installation
+# is requested
+#
 
 # Check whether --enable-systemd was given.
-if test "${enable_systemd+set}" = set; then
-  enableval=$enable_systemd;
-fi
-
-if test "x$enable_systemd" = "xyes"; then
-   GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
-   # if systemd enabled, install service scripts in unitdir
-   SYSTEMD_DIR=`rpm --eval "%{_unitdir}"`
-else
-   # otherwise install the systemd service scripts in the data dir
-  if test  "x$sysname" = "xDarwin" ; then
-    # MacOS 'which' command returns 0 always
-    SYSTEMD_DIR=/usr/share/ipmiutil
-  else
+if test "${enable_systemd+set}" = set; then :
+  withval=$enable_systemd; if test "$withval" = yes; then
+  GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
+  if test -z "$systemddir"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
+$as_echo_n "checking location of the systemd unit files directory... " >&6; }
+    _rpmdir = ""
     which rpm >/dev/null 2>&1
     if test  $? -eq 0 ; then
-       datad=`rpm --eval "%{_datadir}"`
-       SYSTEMD_DIR=${datad}/ipmiutil
-    else
-       SYSTEMD_DIR=/usr/share/ipmiutil
+      _rpmdir = `rpm --eval "%{_unitdir}"`
     fi
+    for systemd_d in ${datadir}/usr/share/ipmiutil ${_rpmdir} /usr/share/ipmiutil; do
+      if test -z "$systemddir"; then
+        if test -d "$systemd_d"; then
+          systemddir="$systemd_d"
+        fi
+      fi
+    done
   fi
+  if test -n "$systemddir"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
+$as_echo "$systemddir" >&6; }
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+else
+ if test "$withval" != no; then
+  systemddir=$withval
+ fi
+fi
 fi
 
 case "$archm" in
Index: ipmiutil-2.9.6/configure.ac
===================================================================
--- ipmiutil-2.9.6.orig/configure.ac
+++ ipmiutil-2.9.6/configure.ac
@@ -140,7 +140,6 @@ CROSS_LFLAGS=""
 CROSS_CFLAGS=""
 LIBSENSORS=""
 SAM2OBJ="isensor2.o ievents2.o"
-SYSTEMD_DIR=/usr/share/ipmiutil
 
 AC_ARG_ENABLE([useflags],
     [  --enable-useflags    include environment CFLAGS and LDFLAGS.],
@@ -191,25 +190,42 @@ AC_ARG_ENABLE([gpl],
 
 dnl Does this Linux have systemd enabled?  Otherwise use sysv init.
 AC_ARG_ENABLE([systemd],
-    [  --enable-systemd       enable systemd service type=notify support and %_unitdir [[default=disabled]]],)
-if test "x$enable_systemd" = "xyes"; then
-   GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
-   # if systemd enabled, install service scripts in unitdir
-   SYSTEMD_DIR=`rpm --eval "%{_unitdir}"`
+    [  --enable-systemd[=systemddir]      install systemd unit file.  If 'yes'
+        probe the system for unit directory.
+        If a path is specified, assume that
+        is a valid install path. [[default=disabled]]],)
+# Check whether --enable-systemd was given.
+if test "${enable_systemd+set}" = set; then :
+	withval=$enable_systemd; if test "$withval" = yes; then
+	GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
+	if test -z "$systemddir"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
+		$as_echo_n "checking location of the systemd unit files directory... " >&6; }
+		_rpmdir = ""
+		which rpm >/dev/null 2>&1
+		if test  $? -eq 0 ; then
+			_rpmdir = `rpm --eval "%{_unitdir}"`
+		fi
+		for systemd_d in ${datadir}/usr/share/ipmiutil ${_rpmdir} /usr/share/ipmiutil; do
+			if test -z "$systemddir"; then
+				if test -d "$systemd_d"; then
+					systemddir="$systemd_d"
+				fi
+			fi
+		done
+	fi
+	if test -n "$systemddir"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
+		$as_echo "$systemddir" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+		$as_echo "not found" >&6; }
+	fi
 else
-   # otherwise install the systemd service scripts in the data dir
-  if test  "x$sysname" = "xDarwin" ; then
-    # MacOS 'which' command returns 0 always
-    SYSTEMD_DIR=/usr/share/ipmiutil
-  else
-    which rpm >/dev/null 2>&1
-    if test  $? -eq 0 ; then
-       datad=`rpm --eval "%{_datadir}"`
-       SYSTEMD_DIR=${datad}/ipmiutil
-    else
-       SYSTEMD_DIR=/usr/share/ipmiutil
-    fi
-  fi
+	if test "$withval" != no; then
+		systemddir=$withval
+	fi
+fi
 fi
 
 dnl start main logic
@@ -481,7 +497,7 @@ AC_SUBST(INS_LIB)
 AC_SUBST(SUBDIR_S)
 AC_SUBST(CROSS_CFLAGS)
 AC_SUBST(CROSS_LFLAGS)
-AC_SUBST(SYSTEMD_DIR)
+AC_SUBST(systemddir)
 AC_SUBST(SHR_LINK)
 AC_SUBST(pkgconfigdir)
 
Index: ipmiutil-2.9.6/Makefile.in
===================================================================
--- ipmiutil-2.9.6.orig/Makefile.in
+++ ipmiutil-2.9.6/Makefile.in
@@ -182,7 +182,7 @@ SHELL = @SHELL@
 SHR_LINK = @SHR_LINK@
 STRIP = @STRIP@
 SUBDIR_S = @SUBDIR_S@
-SYSTEMD_DIR = @SYSTEMD_DIR@
+SYSTEMD_DIR = @systemddir@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -233,6 +233,7 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
+systemddir = @systemddir@
 target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
Index: ipmiutil-2.9.6/scripts/Makefile.in
===================================================================
--- ipmiutil-2.9.6.orig/scripts/Makefile.in
+++ ipmiutil-2.9.6/scripts/Makefile.in
@@ -126,7 +126,7 @@ SHELL = @SHELL@
 SHR_LINK = @SHR_LINK@
 STRIP = @STRIP@
 SUBDIR_S = @SUBDIR_S@
-SYSTEMD_DIR = @SYSTEMD_DIR@
+SYSTEMD_DIR = @systemddir@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -195,7 +195,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily
 sbinto = ${DESTDIR}${sbindir}
 varto = ${DESTDIR}/var/lib/ipmiutil
 initto = ${DESTDIR}@INIT_DIR@
-sysdto = ${DESTDIR}@SYSTEMD_DIR@
+sysdto = ${DESTDIR}@systemddir@
+systemddir = @systemddir@
 sysvinit = ${datato}
 sbinfls = ialarms ihealth ifru igetevent ireset icmd isol ilan isensor isel iserial iwdt iconfig ipicmg ifirewall ifwum ihpm
 all: all-am
@@ -398,11 +399,14 @@ install:
 	${INSTALL_SCRIPT_SH} evt.sh       ${datato}
 	if [ -f /etc/debian_version ]; then \
 	   sysvinit=${initto}; fi
-	${INSTALL_SCRIPT_SH} ipmiutil_wdt ${sysvinit}/ipmiutil_wdt
-	${INSTALL_SCRIPT_SH} ipmiutil_asy ${sysvinit}/ipmiutil_asy
-	${INSTALL_SCRIPT_SH} ipmiutil_evt ${sysvinit}/ipmiutil_evt
-	${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port
-	${INSTALL_SCRIPT_SH} ipmi_info    ${sysvinit}/ipmi_info
+	if [ ! -z "${systemddir}" ]; then \
+		$(MKDIR) ${sysdto}; \
+		${INSTALL_SCRIPT_SH} ipmiutil_wdt ${sysvinit}/ipmiutil_wdt; \
+		${INSTALL_SCRIPT_SH} ipmiutil_asy ${sysvinit}/ipmiutil_asy; \
+		${INSTALL_SCRIPT_SH} ipmiutil_evt ${sysvinit}/ipmiutil_evt; \
+		${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port; \
+		${INSTALL_SCRIPT_SH} ipmi_info    ${sysvinit}/ipmi_info; \
+	fi
 	${INSTALL_SCRIPT_SH} checksel     ${datato}
 	${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}
 	${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}
Index: ipmiutil-2.9.6/scripts/Makefile.am
===================================================================
--- ipmiutil-2.9.6.orig/scripts/Makefile.am
+++ ipmiutil-2.9.6/scripts/Makefile.am
@@ -17,7 +17,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily
 sbinto = ${DESTDIR}${sbindir}
 varto  = ${DESTDIR}/var/lib/ipmiutil
 initto = ${DESTDIR}@INIT_DIR@
-sysdto = ${DESTDIR}@SYSTEMD_DIR@
+sysdto = ${DESTDIR}@systemddir@
+systemddir = @systemddir@
 sysvinit = ${datato}
 sbinfls = ialarms ihealth ifru igetevent ireset icmd isol ilan isensor isel iserial iwdt iconfig ipicmg ifirewall ifwum ihpm
 
@@ -47,10 +48,14 @@ install:
 	${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port
 	${INSTALL_SCRIPT_SH} ipmi_info    ${sysvinit}/ipmi_info
 	${INSTALL_SCRIPT_SH} checksel     ${datato}
-	${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}
-	${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}
-	${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}
-	${INSTALL_DATA_SH} ipmi_port.service    ${sysdto}
+	
+	if [ ! -z "${systemddir}" ]; then \
+		$(MKDIR) ${sysdto}; \
+		${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}; \
+		${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}; \
+		${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}; \
+		${INSTALL_DATA_SH} ipmi_port.service    ${sysdto}; \
+	fi
 	${INSTALL_SCRIPT_SH} ipmiutil.env     ${datato}
 	${INSTALL_SCRIPT_SH} ipmiutil.pre     ${datato}
 	${INSTALL_SCRIPT_SH} ipmiutil.setup   ${datato}
Index: ipmiutil-2.9.6/lib/Makefile.in
===================================================================
--- ipmiutil-2.9.6.orig/lib/Makefile.in
+++ ipmiutil-2.9.6/lib/Makefile.in
@@ -128,7 +128,7 @@ SHELL = @SHELL@
 SHR_LINK = @SHR_LINK@
 STRIP = @STRIP@
 SUBDIR_S = @SUBDIR_S@
-SYSTEMD_DIR = @SYSTEMD_DIR@
+SYSTEMD_DIR = @systemddir@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
Index: ipmiutil-2.9.6/lib/lanplus/Makefile.in
===================================================================
--- ipmiutil-2.9.6.orig/lib/lanplus/Makefile.in
+++ ipmiutil-2.9.6/lib/lanplus/Makefile.in
@@ -177,7 +177,8 @@ SHELL = @SHELL@
 SHR_LINK = @SHR_LINK@
 STRIP = @STRIP@
 SUBDIR_S = @SUBDIR_S@
-SYSTEMD_DIR = @SYSTEMD_DIR@
+SYSTEMD_DIR = @systemddir@
+systemddir = @systemddir@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@