blob: d47e086c46f515589e1c300b4113f4852edc2e21 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001allow systemd path to be defined by configure option.
2
3The configure probes the host for systemd path information.
4
Patrick Williamsb9af8752023-01-30 13:28:01 -06005Upstream-Status: Inappropriate [Embedded]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05006
Patrick Williamsb9af8752023-01-30 13:28:01 -06007Signed-off-by: Armin Kuster <akuster@mvista.com>
Patrick Williamsb48b7b42016-08-17 15:04:38 -05008
Brad Bishopd7bf8c12018-02-25 22:55:05 -05009Index: ipmiutil-3.0.5/configure.ac
Patrick Williamsb48b7b42016-08-17 15:04:38 -050010===================================================================
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011--- ipmiutil-3.0.5.orig/configure.ac
12+++ ipmiutil-3.0.5/configure.ac
13@@ -149,7 +149,6 @@ CROSS_LFLAGS=""
Patrick Williamsb48b7b42016-08-17 15:04:38 -050014 CROSS_CFLAGS=""
15 LIBSENSORS=""
16 SAM2OBJ="isensor2.o ievents2.o"
17-SYSTEMD_DIR=/usr/share/ipmiutil
18
19 AC_ARG_ENABLE([useflags],
20 [ --enable-useflags include environment CFLAGS and LDFLAGS.],
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021@@ -200,29 +199,42 @@ AC_ARG_ENABLE([gpl],
Patrick Williamsb48b7b42016-08-17 15:04:38 -050022
23 dnl Does this Linux have systemd enabled? Otherwise use sysv init.
24 AC_ARG_ENABLE([systemd],
25- [ --enable-systemd enable systemd service type=notify support and %_unitdir [[default=disabled]]],)
26-if test "x$enable_systemd" = "xyes"; then
27- GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
28- # if systemd enabled, install service scripts in unitdir
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029- which rpm >/dev/null 2>&1
30- if test $? -eq 0 ; then
31- SYSTEMD_DIR=`rpm --eval "%{_unitdir}"`
32- else
33- SYSTEMD_DIR=/usr/share/ipmiutil
34- fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -050035+ [ --enable-systemd[=systemddir] install systemd unit file. If 'yes'
36+ probe the system for unit directory.
37+ If a path is specified, assume that
38+ is a valid install path. [[default=disabled]]],)
39+# Check whether --enable-systemd was given.
40+if test "${enable_systemd+set}" = set; then :
41+ withval=$enable_systemd; if test "$withval" = yes; then
42+ GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD"
43+ if test -z "$systemddir"; then
44+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
45+ $as_echo_n "checking location of the systemd unit files directory... " >&6; }
46+ _rpmdir = ""
47+ which rpm >/dev/null 2>&1
48+ if test $? -eq 0 ; then
49+ _rpmdir = `rpm --eval "%{_unitdir}"`
50+ fi
51+ for systemd_d in ${datadir}/usr/share/ipmiutil ${_rpmdir} /usr/share/ipmiutil; do
52+ if test -z "$systemddir"; then
53+ if test -d "$systemd_d"; then
54+ systemddir="$systemd_d"
55+ fi
56+ fi
57+ done
58+ fi
59+ if test -n "$systemddir"; then
60+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
61+ $as_echo "$systemddir" >&6; }
62+ else
63+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
64+ $as_echo "not found" >&6; }
65+ fi
66 else
67- # otherwise install the systemd service scripts in the data dir
Brad Bishopd7bf8c12018-02-25 22:55:05 -050068- SYSTEMD_DIR=/usr/share/ipmiutil
69- if test "x$sysname" != "xDarwin" ; then
70- if test "x$os" != "xhpux" ; then
71- # MacOS and HP-UX: 'which' command returns 0 always
72- which rpm >/dev/null 2>&1
73- if test $? -eq 0 ; then
74- datad=`rpm --eval "%{_datadir}"`
75- SYSTEMD_DIR=${datad}/ipmiutil
76- fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -050077- fi
78- fi
79+ if test "$withval" != no; then
80+ systemddir=$withval
81+ fi
82+fi
83 fi
84
85 dnl start main logic
Brad Bishopd7bf8c12018-02-25 22:55:05 -050086@@ -528,7 +540,7 @@ AC_SUBST(INS_LIB)
Patrick Williamsb48b7b42016-08-17 15:04:38 -050087 AC_SUBST(SUBDIR_S)
88 AC_SUBST(CROSS_CFLAGS)
89 AC_SUBST(CROSS_LFLAGS)
90-AC_SUBST(SYSTEMD_DIR)
91+AC_SUBST(systemddir)
92 AC_SUBST(SHR_LINK)
93 AC_SUBST(pkgconfigdir)
94
Brad Bishopd7bf8c12018-02-25 22:55:05 -050095Index: ipmiutil-3.0.5/scripts/Makefile.am
Patrick Williamsb48b7b42016-08-17 15:04:38 -050096===================================================================
Brad Bishopd7bf8c12018-02-25 22:55:05 -050097--- ipmiutil-3.0.5.orig/scripts/Makefile.am
98+++ ipmiutil-3.0.5/scripts/Makefile.am
Patrick Williamsb48b7b42016-08-17 15:04:38 -050099@@ -17,7 +17,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily
100 sbinto = ${DESTDIR}${sbindir}
101 varto = ${DESTDIR}/var/lib/ipmiutil
102 initto = ${DESTDIR}@INIT_DIR@
103-sysdto = ${DESTDIR}@SYSTEMD_DIR@
104+sysdto = ${DESTDIR}@systemddir@
105+systemddir = @systemddir@
106 sysvinit = ${datato}
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500107 sbinfls = ialarms ihealth ifru igetevent ireset icmd isol ilan isensor isel iserial iwdt iconfig ipicmg ifirewall ifwum ihpm iuser
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500108
109@@ -47,10 +48,14 @@ install:
110 ${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port
111 ${INSTALL_SCRIPT_SH} ipmi_info ${sysvinit}/ipmi_info
112 ${INSTALL_SCRIPT_SH} checksel ${datato}
113- ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}
114- ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}
115- ${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}
116- ${INSTALL_DATA_SH} ipmi_port.service ${sysdto}
117+
118+ if [ ! -z "${systemddir}" ]; then \
119+ $(MKDIR) ${sysdto}; \
120+ ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}; \
121+ ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}; \
122+ ${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}; \
123+ ${INSTALL_DATA_SH} ipmi_port.service ${sysdto}; \
124+ fi
125 ${INSTALL_SCRIPT_SH} ipmiutil.env ${datato}
126 ${INSTALL_SCRIPT_SH} ipmiutil.pre ${datato}
127 ${INSTALL_SCRIPT_SH} ipmiutil.setup ${datato}