Skip to content

Commit

Permalink
Fixes #2675 add support for systemd
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Oct 5, 2018
1 parent 00875b4 commit 604755d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,18 @@ AC_ARG_ENABLE([man],
AC_SUBST(MAN,"")
fi])

dnl systemd system unit files location
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR@:>@],[systemd system files location]),
[enable_systemd=yes],
[enable_systemd=no])

dnl enable systemd and set unit dir
AC_SUBST(enable_systemd)
AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x$enable_systemd" = "xyes"])
unitdir=$with_systemdsystemunitdir
AC_SUBST(unitdir)

AC_CONFIG_FILES([openhpi.spec
openhpi.pc
rt-env.sh
Expand Down Expand Up @@ -818,6 +830,7 @@ AC_CONFIG_FILES([openhpi.spec
docs/man/Makefile
openhpid/Makefile
openhpid/openhpid.sh
openhpid/openhpid.service
openhpid/t/Makefile
openhpid/t/ohpi/Makefile
hpi_shell/Makefile
Expand Down
4 changes: 4 additions & 0 deletions openhpi.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,11 @@ make DESTDIR=%{buildroot} install
%{_mandir}/man7/%{name}.7*
%{_mandir}/man8/%{name}d.8*
%{_sbindir}/openhpid
%if "x@enable_systemd@" == "xyes"
/@unitdir@/openhpid.service
%else
%{_sysconfdir}/init.d/openhpid
%endif

###################################################
%files devel
Expand Down
7 changes: 7 additions & 0 deletions openhpid/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DIST_SUBDIRS = t

EXTRA_DIST = \
openhpid.sh.in \
openhpid.service.in \
Makefile.mingw32 \
openhpid-win32.cpp \
version.rc
Expand Down Expand Up @@ -83,11 +84,17 @@ endif


install-data-local:
if ENABLE_SYSTEMD
$(mkinstalldirs) $(DESTDIR)$(unitdir)
$(INSTALL) -m 0644 openhpid.service $(DESTDIR)$(unitdir)
else
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)/init.d
$(INSTALL) -m 0755 openhpid.sh $(DESTDIR)$(sysconfdir)/init.d/openhpid
endif

uninstall-local:
rm -f $(DESTDIR)$(sysconfdir)/init.d/openhpid
rm -f $(DESTDIR)$(unitdir)/openhpid.service

clean-local:
rm -f *~ core core.*
11 changes: 11 additions & 0 deletions openhpid/openhpid.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Daemon providing access to the SAF Hardware Platform Interface
After=syslog.target

[Service]
Type=forking
PIDFile=/var/run/openhpid.pid
ExecStart=@sbindir@/openhpid -c @sysconfdir@/openhpi/openhpi.conf

[Install]
WantedBy=multi-user.target

0 comments on commit 604755d

Please sign in to comment.