Commit d7c07fc9 authored by SATOH Fumiyasu's avatar SATOH Fumiyasu Committed by Quanah Gibson-Mount

ITS#8707 - Add slapd.service and lloadd.service for systemd

parent 37d60fe6
Pipeline #1980 failed with stage
in 62 minutes and 51 seconds
......@@ -45,6 +45,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@$(ldap_subdir)
schemadir = $(sysconfdir)/schema
systemdsystemunitdir = @systemdsystemunitdir@
PLAT = @PLAT@
EXEEXT = @EXEEXT@
......
......@@ -2059,6 +2059,7 @@ dnl
dnl Check for systemd
dnl
WITH_SYSTEMD=no
systemdsystemunitdir=
ol_link_systemd=no
if test $ol_with_systemd != no ; then
AC_CHECK_HEADERS(systemd/sd-daemon.h)
......@@ -2082,6 +2083,17 @@ if test $ol_with_systemd != no ; then
fi
fi
if test $WITH_SYSTEMD = yes; then
if test "$PKG_CONFIG" != no ; then
systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
elif test -d /usr/lib/systemd/system; then
systemdsystemunitdir=/usr/lib/systemd/system
else
systemdsystemunitdir=/lib/systemd/system
fi
fi
AC_SUBST(systemdsystemunitdir)
dnl ----------------------------------------------------------------
dnl Check for entropy sources
if test $cross_compiling != yes && test "$ac_cv_mingw32" != yes ; then
......
......@@ -29,7 +29,7 @@ OBJS = $(patsubst %.c,%.o,$(SRCS)) $(@PLAT@_OBJS)
BUILD_OPT = "--enable-balancer"
BUILD_SRV = @BUILD_BALANCER@
all-local-srv: $(PROGRAMS)
all-local-srv: $(PROGRAMS) all-cffiles
# $(LTHREAD_LIBS) must be last!
XLIBS = $(LLOADD_L)
......@@ -58,7 +58,19 @@ version.c: Makefile
version.o: version.c $(OBJS) $(LLOADD_L)
install-local-srv: FORCE
all-cffiles:
@if test -n "$(systemdsystemunitdir)"; then \
$(SED) -e "s;%LIBEXECDIR%;$(libexecdir);" \
$(srcdir)/lloadd.service > lloadd.service.tmp ; \
fi
touch all-cffiles
clean-local-srv: FORCE
$(RM) *.tmp all-cffiles
install-local-srv: install-lloadd install-conf
install-lloadd: FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-lloadd
@( \
......@@ -67,3 +79,12 @@ install-local-srv: FORCE
$(DESTDIR)$(libexecdir); \
done \
)
install-conf: FORCE
@-$(MKDIR) $(DESTDIR)$(sysconfdir)
if test -n "$(systemdsystemunitdir)" && test ! -f $(DESTDIR)$(systemdsystemunitdir)/lloadd.service; then \
$(MKDIR) $(DESTDIR)$(systemdsystemunitdir); \
echo "installing lloadd.service in $(systemdsystemunitdir)"; \
echo "$(INSTALL) $(INSTALLFLAGS) -m 644 lloadd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/lloadd.service"; \
$(INSTALL) $(INSTALLFLAGS) -m 644 lloadd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/lloadd.service; \
fi
[Unit]
Description=LDAP Load Balancer Daemon
After=syslog.target network-online.target
Documentation=man:lloadd.conf
[Service]
Type=notify
Environment="LLOADD_URLS=ldap:/// ldapi:///" "LLOADD_OPTIONS="
EnvironmentFile=/etc/sysconfig/lloadd
ExecStart=%LIBEXECDIR%/lloadd -d 0 -h ${LLOADD_URLS} $LLOADD_OPTIONS
[Install]
WantedBy=multi-user.target
......@@ -398,11 +398,15 @@ all-cffiles: slapd $(SLAPD_DYNAMIC_BACKENDS) dynamic_overlays
$(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
-e "s;%LOCALSTATEDIR%;$$localstatedir;" \
-e "s;%MODULEDIR%;$$moduledir;" \
$(srcdir)/slapd.conf > slapd.conf.tmp ; \
$(srcdir)/slapd.conf > slapd.conf.tmp || exit $$? ; \
$(SED) -e "s;%SYSCONFDIR%;$$sysconfdir;" \
-e "s;%LOCALSTATEDIR%;$$localstatedir;" \
-e "s;%MODULEDIR%;$$moduledir;" \
$(srcdir)/slapd.ldif > slapd.ldif.tmp ; \
$(srcdir)/slapd.ldif > slapd.ldif.tmp || exit $$? ;
@if test -n "$(systemdsystemunitdir)"; then \
$(SED) -e "s;%LIBEXECDIR%;$(libexecdir);" \
$(srcdir)/slapd.service > slapd.service.tmp ; \
fi
touch all-cffiles
install-schema: FORCE
......@@ -436,6 +440,12 @@ install-conf: FORCE
else \
echo "PRESERVING EXISTING CONFIGURATION FILE $(DESTDIR)$(sysconfdir)/slapd.ldif" ; \
fi
if test -n "$(systemdsystemunitdir)" && test ! -f $(DESTDIR)$(systemdsystemunitdir)/slapd.service; then \
$(MKDIR) $(DESTDIR)$(systemdsystemunitdir); \
echo "installing slapd.service in $(systemdsystemunitdir)"; \
echo "$(INSTALL) $(INSTALLFLAGS) -m 644 slapd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/slapd.service"; \
$(INSTALL) $(INSTALLFLAGS) -m 644 slapd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/slapd.service; \
fi
install-db-config: FORCE
@-$(MKDIR) $(DESTDIR)$(localstatedir) $(DESTDIR)$(sysconfdir)
......
[Unit]
Description=OpenLDAP Server Daemon
After=syslog.target network-online.target
Documentation=man:slapd
Documentation=man:slapd-config
Documentation=man:slapd-mdb
[Service]
Type=notify
Environment="SLAPD_URLS=ldap:/// ldapi:///" "SLAPD_OPTIONS="
EnvironmentFile=/etc/sysconfig/slapd
ExecStart=%LIBEXECDIR%/slapd -d 0 -h ${SLAPD_URLS} $SLAPD_OPTIONS
[Install]
WantedBy=multi-user.target
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment