Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | allow systemd path to be defined by configure option. |
| 2 | |
| 3 | The configure probes the host for systemd path information. |
| 4 | |
| 5 | Upstream Status: Inappropriate [Embedded] |
| 6 | |
| 7 | Signed-off-By: Armin Kuster <akuster@mvista.com> |
| 8 | |
| 9 | Index: ipmiutil-2.9.6/configure |
| 10 | =================================================================== |
| 11 | --- ipmiutil-2.9.6.orig/configure |
| 12 | +++ ipmiutil-2.9.6/configure |
| 13 | @@ -792,7 +792,6 @@ LTLIBOBJS |
| 14 | LIBOBJS |
| 15 | pkgconfigdir |
| 16 | SHR_LINK |
| 17 | -SYSTEMD_DIR |
| 18 | CROSS_LFLAGS |
| 19 | CROSS_CFLAGS |
| 20 | SUBDIR_S |
| 21 | @@ -999,7 +998,7 @@ psdir='${docdir}' |
| 22 | libdir='${exec_prefix}/lib' |
| 23 | localedir='${datarootdir}/locale' |
| 24 | mandir='${datarootdir}/man' |
| 25 | - |
| 26 | +systemddir='${datarootdir}/ipmiutil' |
| 27 | ac_prev= |
| 28 | ac_dashdash= |
| 29 | for ac_option |
| 30 | @@ -1594,7 +1593,10 @@ Optional Features: |
| 31 | --enable-standalone build standalone, with no GPL or LanPlus libs. |
| 32 | --enable-libsensors build libipmiutil with sensor modules [default=no] |
| 33 | --enable-gpl build with some GPL code [default=no] |
| 34 | - --enable-systemd enable systemd service type=notify support and %_unitdir [default=disabled] |
| 35 | + --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 | |
| 40 | Optional Packages: |
| 41 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
| 42 | @@ -12980,7 +12982,6 @@ CROSS_LFLAGS="" |
| 43 | CROSS_CFLAGS="" |
| 44 | LIBSENSORS="" |
| 45 | SAM2OBJ="isensor2.o ievents2.o" |
| 46 | -SYSTEMD_DIR=/usr/share/ipmiutil |
| 47 | |
| 48 | # Check whether --enable-useflags was given. |
| 49 | if test "${enable_useflags+set}" = set; then |
| 50 | @@ -13032,31 +13033,43 @@ if test "${enable_gpl+set}" = set; then |
| 51 | fi |
| 52 | |
| 53 | fi |
| 54 | - |
| 55 | +# |
| 56 | +# Check for systemd unit files direectory exists if unit file installation |
| 57 | +# is requested |
| 58 | +# |
| 59 | |
| 60 | # Check whether --enable-systemd was given. |
| 61 | -if test "${enable_systemd+set}" = set; then |
| 62 | - enableval=$enable_systemd; |
| 63 | -fi |
| 64 | - |
| 65 | -if test "x$enable_systemd" = "xyes"; then |
| 66 | - GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD" |
| 67 | - # if systemd enabled, install service scripts in unitdir |
| 68 | - SYSTEMD_DIR=`rpm --eval "%{_unitdir}"` |
| 69 | -else |
| 70 | - # otherwise install the systemd service scripts in the data dir |
| 71 | - if test "x$sysname" = "xDarwin" ; then |
| 72 | - # MacOS 'which' command returns 0 always |
| 73 | - SYSTEMD_DIR=/usr/share/ipmiutil |
| 74 | - else |
| 75 | +if test "${enable_systemd+set}" = set; then : |
| 76 | + withval=$enable_systemd; if test "$withval" = yes; then |
| 77 | + GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD" |
| 78 | + if test -z "$systemddir"; then |
| 79 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5 |
| 80 | +$as_echo_n "checking location of the systemd unit files directory... " >&6; } |
| 81 | + _rpmdir = "" |
| 82 | which rpm >/dev/null 2>&1 |
| 83 | if test $? -eq 0 ; then |
| 84 | - datad=`rpm --eval "%{_datadir}"` |
| 85 | - SYSTEMD_DIR=${datad}/ipmiutil |
| 86 | - else |
| 87 | - SYSTEMD_DIR=/usr/share/ipmiutil |
| 88 | + _rpmdir = `rpm --eval "%{_unitdir}"` |
| 89 | fi |
| 90 | + for systemd_d in ${datadir}/usr/share/ipmiutil ${_rpmdir} /usr/share/ipmiutil; do |
| 91 | + if test -z "$systemddir"; then |
| 92 | + if test -d "$systemd_d"; then |
| 93 | + systemddir="$systemd_d" |
| 94 | + fi |
| 95 | + fi |
| 96 | + done |
| 97 | fi |
| 98 | + if test -n "$systemddir"; then |
| 99 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5 |
| 100 | +$as_echo "$systemddir" >&6; } |
| 101 | + else |
| 102 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 |
| 103 | +$as_echo "not found" >&6; } |
| 104 | + fi |
| 105 | +else |
| 106 | + if test "$withval" != no; then |
| 107 | + systemddir=$withval |
| 108 | + fi |
| 109 | +fi |
| 110 | fi |
| 111 | |
| 112 | case "$archm" in |
| 113 | Index: ipmiutil-2.9.6/configure.ac |
| 114 | =================================================================== |
| 115 | --- ipmiutil-2.9.6.orig/configure.ac |
| 116 | +++ ipmiutil-2.9.6/configure.ac |
| 117 | @@ -140,7 +140,6 @@ CROSS_LFLAGS="" |
| 118 | CROSS_CFLAGS="" |
| 119 | LIBSENSORS="" |
| 120 | SAM2OBJ="isensor2.o ievents2.o" |
| 121 | -SYSTEMD_DIR=/usr/share/ipmiutil |
| 122 | |
| 123 | AC_ARG_ENABLE([useflags], |
| 124 | [ --enable-useflags include environment CFLAGS and LDFLAGS.], |
| 125 | @@ -191,25 +190,42 @@ AC_ARG_ENABLE([gpl], |
| 126 | |
| 127 | dnl Does this Linux have systemd enabled? Otherwise use sysv init. |
| 128 | AC_ARG_ENABLE([systemd], |
| 129 | - [ --enable-systemd enable systemd service type=notify support and %_unitdir [[default=disabled]]],) |
| 130 | -if test "x$enable_systemd" = "xyes"; then |
| 131 | - GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD" |
| 132 | - # if systemd enabled, install service scripts in unitdir |
| 133 | - SYSTEMD_DIR=`rpm --eval "%{_unitdir}"` |
| 134 | + [ --enable-systemd[=systemddir] install systemd unit file. If 'yes' |
| 135 | + probe the system for unit directory. |
| 136 | + If a path is specified, assume that |
| 137 | + is a valid install path. [[default=disabled]]],) |
| 138 | +# Check whether --enable-systemd was given. |
| 139 | +if test "${enable_systemd+set}" = set; then : |
| 140 | + withval=$enable_systemd; if test "$withval" = yes; then |
| 141 | + GPL_CFLAGS="$GPL_CFLAGS -DENABLE_SYSTEMD" |
| 142 | + if test -z "$systemddir"; then |
| 143 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5 |
| 144 | + $as_echo_n "checking location of the systemd unit files directory... " >&6; } |
| 145 | + _rpmdir = "" |
| 146 | + which rpm >/dev/null 2>&1 |
| 147 | + if test $? -eq 0 ; then |
| 148 | + _rpmdir = `rpm --eval "%{_unitdir}"` |
| 149 | + fi |
| 150 | + for systemd_d in ${datadir}/usr/share/ipmiutil ${_rpmdir} /usr/share/ipmiutil; do |
| 151 | + if test -z "$systemddir"; then |
| 152 | + if test -d "$systemd_d"; then |
| 153 | + systemddir="$systemd_d" |
| 154 | + fi |
| 155 | + fi |
| 156 | + done |
| 157 | + fi |
| 158 | + if test -n "$systemddir"; then |
| 159 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5 |
| 160 | + $as_echo "$systemddir" >&6; } |
| 161 | + else |
| 162 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 |
| 163 | + $as_echo "not found" >&6; } |
| 164 | + fi |
| 165 | else |
| 166 | - # otherwise install the systemd service scripts in the data dir |
| 167 | - if test "x$sysname" = "xDarwin" ; then |
| 168 | - # MacOS 'which' command returns 0 always |
| 169 | - SYSTEMD_DIR=/usr/share/ipmiutil |
| 170 | - else |
| 171 | - which rpm >/dev/null 2>&1 |
| 172 | - if test $? -eq 0 ; then |
| 173 | - datad=`rpm --eval "%{_datadir}"` |
| 174 | - SYSTEMD_DIR=${datad}/ipmiutil |
| 175 | - else |
| 176 | - SYSTEMD_DIR=/usr/share/ipmiutil |
| 177 | - fi |
| 178 | - fi |
| 179 | + if test "$withval" != no; then |
| 180 | + systemddir=$withval |
| 181 | + fi |
| 182 | +fi |
| 183 | fi |
| 184 | |
| 185 | dnl start main logic |
| 186 | @@ -481,7 +497,7 @@ AC_SUBST(INS_LIB) |
| 187 | AC_SUBST(SUBDIR_S) |
| 188 | AC_SUBST(CROSS_CFLAGS) |
| 189 | AC_SUBST(CROSS_LFLAGS) |
| 190 | -AC_SUBST(SYSTEMD_DIR) |
| 191 | +AC_SUBST(systemddir) |
| 192 | AC_SUBST(SHR_LINK) |
| 193 | AC_SUBST(pkgconfigdir) |
| 194 | |
| 195 | Index: ipmiutil-2.9.6/Makefile.in |
| 196 | =================================================================== |
| 197 | --- ipmiutil-2.9.6.orig/Makefile.in |
| 198 | +++ ipmiutil-2.9.6/Makefile.in |
| 199 | @@ -182,7 +182,7 @@ SHELL = @SHELL@ |
| 200 | SHR_LINK = @SHR_LINK@ |
| 201 | STRIP = @STRIP@ |
| 202 | SUBDIR_S = @SUBDIR_S@ |
| 203 | -SYSTEMD_DIR = @SYSTEMD_DIR@ |
| 204 | +SYSTEMD_DIR = @systemddir@ |
| 205 | VERSION = @VERSION@ |
| 206 | abs_builddir = @abs_builddir@ |
| 207 | abs_srcdir = @abs_srcdir@ |
| 208 | @@ -233,6 +233,7 @@ sbindir = @sbindir@ |
| 209 | sharedstatedir = @sharedstatedir@ |
| 210 | srcdir = @srcdir@ |
| 211 | sysconfdir = @sysconfdir@ |
| 212 | +systemddir = @systemddir@ |
| 213 | target_alias = @target_alias@ |
| 214 | top_build_prefix = @top_build_prefix@ |
| 215 | top_builddir = @top_builddir@ |
| 216 | Index: ipmiutil-2.9.6/scripts/Makefile.in |
| 217 | =================================================================== |
| 218 | --- ipmiutil-2.9.6.orig/scripts/Makefile.in |
| 219 | +++ ipmiutil-2.9.6/scripts/Makefile.in |
| 220 | @@ -126,7 +126,7 @@ SHELL = @SHELL@ |
| 221 | SHR_LINK = @SHR_LINK@ |
| 222 | STRIP = @STRIP@ |
| 223 | SUBDIR_S = @SUBDIR_S@ |
| 224 | -SYSTEMD_DIR = @SYSTEMD_DIR@ |
| 225 | +SYSTEMD_DIR = @systemddir@ |
| 226 | VERSION = @VERSION@ |
| 227 | abs_builddir = @abs_builddir@ |
| 228 | abs_srcdir = @abs_srcdir@ |
| 229 | @@ -195,7 +195,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily |
| 230 | sbinto = ${DESTDIR}${sbindir} |
| 231 | varto = ${DESTDIR}/var/lib/ipmiutil |
| 232 | initto = ${DESTDIR}@INIT_DIR@ |
| 233 | -sysdto = ${DESTDIR}@SYSTEMD_DIR@ |
| 234 | +sysdto = ${DESTDIR}@systemddir@ |
| 235 | +systemddir = @systemddir@ |
| 236 | sysvinit = ${datato} |
| 237 | sbinfls = ialarms ihealth ifru igetevent ireset icmd isol ilan isensor isel iserial iwdt iconfig ipicmg ifirewall ifwum ihpm |
| 238 | all: all-am |
| 239 | @@ -398,11 +399,14 @@ install: |
| 240 | ${INSTALL_SCRIPT_SH} evt.sh ${datato} |
| 241 | if [ -f /etc/debian_version ]; then \ |
| 242 | sysvinit=${initto}; fi |
| 243 | - ${INSTALL_SCRIPT_SH} ipmiutil_wdt ${sysvinit}/ipmiutil_wdt |
| 244 | - ${INSTALL_SCRIPT_SH} ipmiutil_asy ${sysvinit}/ipmiutil_asy |
| 245 | - ${INSTALL_SCRIPT_SH} ipmiutil_evt ${sysvinit}/ipmiutil_evt |
| 246 | - ${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port |
| 247 | - ${INSTALL_SCRIPT_SH} ipmi_info ${sysvinit}/ipmi_info |
| 248 | + if [ ! -z "${systemddir}" ]; then \ |
| 249 | + $(MKDIR) ${sysdto}; \ |
| 250 | + ${INSTALL_SCRIPT_SH} ipmiutil_wdt ${sysvinit}/ipmiutil_wdt; \ |
| 251 | + ${INSTALL_SCRIPT_SH} ipmiutil_asy ${sysvinit}/ipmiutil_asy; \ |
| 252 | + ${INSTALL_SCRIPT_SH} ipmiutil_evt ${sysvinit}/ipmiutil_evt; \ |
| 253 | + ${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port; \ |
| 254 | + ${INSTALL_SCRIPT_SH} ipmi_info ${sysvinit}/ipmi_info; \ |
| 255 | + fi |
| 256 | ${INSTALL_SCRIPT_SH} checksel ${datato} |
| 257 | ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto} |
| 258 | ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto} |
| 259 | Index: ipmiutil-2.9.6/scripts/Makefile.am |
| 260 | =================================================================== |
| 261 | --- ipmiutil-2.9.6.orig/scripts/Makefile.am |
| 262 | +++ ipmiutil-2.9.6/scripts/Makefile.am |
| 263 | @@ -17,7 +17,8 @@ cronto = ${DESTDIR}${etcdir}/cron.daily |
| 264 | sbinto = ${DESTDIR}${sbindir} |
| 265 | varto = ${DESTDIR}/var/lib/ipmiutil |
| 266 | initto = ${DESTDIR}@INIT_DIR@ |
| 267 | -sysdto = ${DESTDIR}@SYSTEMD_DIR@ |
| 268 | +sysdto = ${DESTDIR}@systemddir@ |
| 269 | +systemddir = @systemddir@ |
| 270 | sysvinit = ${datato} |
| 271 | sbinfls = ialarms ihealth ifru igetevent ireset icmd isol ilan isensor isel iserial iwdt iconfig ipicmg ifirewall ifwum ihpm |
| 272 | |
| 273 | @@ -47,10 +48,14 @@ install: |
| 274 | ${INSTALL_SCRIPT_SH} ipmi_port.sh ${sysvinit}/ipmi_port |
| 275 | ${INSTALL_SCRIPT_SH} ipmi_info ${sysvinit}/ipmi_info |
| 276 | ${INSTALL_SCRIPT_SH} checksel ${datato} |
| 277 | - ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto} |
| 278 | - ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto} |
| 279 | - ${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto} |
| 280 | - ${INSTALL_DATA_SH} ipmi_port.service ${sysdto} |
| 281 | + |
| 282 | + if [ ! -z "${systemddir}" ]; then \ |
| 283 | + $(MKDIR) ${sysdto}; \ |
| 284 | + ${INSTALL_DATA_SH} ipmiutil_wdt.service ${sysdto}; \ |
| 285 | + ${INSTALL_DATA_SH} ipmiutil_asy.service ${sysdto}; \ |
| 286 | + ${INSTALL_DATA_SH} ipmiutil_evt.service ${sysdto}; \ |
| 287 | + ${INSTALL_DATA_SH} ipmi_port.service ${sysdto}; \ |
| 288 | + fi |
| 289 | ${INSTALL_SCRIPT_SH} ipmiutil.env ${datato} |
| 290 | ${INSTALL_SCRIPT_SH} ipmiutil.pre ${datato} |
| 291 | ${INSTALL_SCRIPT_SH} ipmiutil.setup ${datato} |
| 292 | Index: ipmiutil-2.9.6/lib/Makefile.in |
| 293 | =================================================================== |
| 294 | --- ipmiutil-2.9.6.orig/lib/Makefile.in |
| 295 | +++ ipmiutil-2.9.6/lib/Makefile.in |
| 296 | @@ -128,7 +128,7 @@ SHELL = @SHELL@ |
| 297 | SHR_LINK = @SHR_LINK@ |
| 298 | STRIP = @STRIP@ |
| 299 | SUBDIR_S = @SUBDIR_S@ |
| 300 | -SYSTEMD_DIR = @SYSTEMD_DIR@ |
| 301 | +SYSTEMD_DIR = @systemddir@ |
| 302 | VERSION = @VERSION@ |
| 303 | abs_builddir = @abs_builddir@ |
| 304 | abs_srcdir = @abs_srcdir@ |
| 305 | Index: ipmiutil-2.9.6/lib/lanplus/Makefile.in |
| 306 | =================================================================== |
| 307 | --- ipmiutil-2.9.6.orig/lib/lanplus/Makefile.in |
| 308 | +++ ipmiutil-2.9.6/lib/lanplus/Makefile.in |
| 309 | @@ -177,7 +177,8 @@ SHELL = @SHELL@ |
| 310 | SHR_LINK = @SHR_LINK@ |
| 311 | STRIP = @STRIP@ |
| 312 | SUBDIR_S = @SUBDIR_S@ |
| 313 | -SYSTEMD_DIR = @SYSTEMD_DIR@ |
| 314 | +SYSTEMD_DIR = @systemddir@ |
| 315 | +systemddir = @systemddir@ |
| 316 | VERSION = @VERSION@ |
| 317 | abs_builddir = @abs_builddir@ |
| 318 | abs_srcdir = @abs_srcdir@ |