Commit f3501534 authored by SATOH Fumiyasu's avatar SATOH Fumiyasu Committed by Quanah Gibson-Mount
Browse files

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

parent 629cafc9
......@@ -45,6 +45,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@$(ldap_subdir)
schemadir = $(sysconfdir)/schema
systemdsystemunitdir = @systemdsystemunitdir@
PLAT = @PLAT@
EXEEXT = @EXEEXT@
......
......@@ -33,6 +33,9 @@ dnl OpenLDAP Autoconf Macros
builtin(include, build/openldap.m4)dnl
dnl ================================================================
m4_ifndef([PKG_PREREQ],
[m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
AC_CONFIG_AUX_DIR(build)dnl
AC_CONFIG_MACRO_DIRS([build])
......@@ -2006,26 +2009,10 @@ dnl ----------------------------------------------------------------
dnl WiredTiger
ol_link_wt=no
if test $ol_enable_wt != no ; then
AC_CHECK_PROG(PKGCONFIG,pkg-config,yes)
if test "$PKGCONFIG" != yes ; then
AC_MSG_ERROR([could not locate pkg-config])
PKG_CHECK_MODULES(WT, wiredtiger)
if test $ol_enable_wt = yes ; then
SLAPD_LIBS="$SLAPD_LIBS \$(WT_LIBS)"
fi
WT_INCS=`pkg-config --cflags wiredtiger`
WT_LIBS=`pkg-config --libs wiredtiger`
save_CFLAGS="$CFLAGS"
save_LDFLAGS="$LDFLAGS"
CFLAGS="$WT_INCS"
CPPFLAGS="$WT_INCS"
LDFLAGS="$WT_LIBS"
AC_CHECK_HEADERS([wiredtiger.h])
AC_CHECK_LIB(wiredtiger,wiredtiger_version,[: ok],[
AC_MSG_ERROR([could not locate wiredtiger library])
])
CFLAGS="$save_CFLAGS"
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
SLAPD_LIBS="$SLAPD_LIBS \$(WT_LIBS)"
ol_link_wt=yes
fi
......@@ -2091,6 +2078,7 @@ dnl
dnl Check for systemd (only if we have a server)
dnl
WITH_SYSTEMD=no
systemdsystemunitdir=
ol_link_systemd=no
if test $ol_enable_slapd == no && test $ol_enable_balancer != yes ; then
if test $ol_with_systemd != no ; then
......@@ -2117,8 +2105,18 @@ if test $ol_with_systemd != no ; then
AC_DEFINE(HAVE_SYSTEMD,1,[define if you have systemd])
SYSTEMD_LIBS="$ol_link_systemd"
WITH_SYSTEMD=yes
PKG_CHECK_VAR(systemdsystemunitdir, systemd, systemdsystemunitdir)
if test -z "$systemdsystemunitdir"; then
if test -d /usr/lib/systemd/system; then
systemdsystemunitdir=/usr/lib/systemd/system
else
systemdsystemunitdir=/lib/systemd/system
fi
fi
fi
fi
AC_SUBST(systemdsystemunitdir)
dnl ----------------------------------------------------------------
dnl Check for entropy sources
......@@ -3260,7 +3258,7 @@ AC_SUBST(SLAPD_SQL_LDFLAGS)
AC_SUBST(SLAPD_SQL_LIBS)
AC_SUBST(SLAPD_SQL_INCLUDES)
AC_SUBST(WT_INCS)
AC_SUBST(WT_CFLAGS)
AC_SUBST(WT_LIBS)
AC_SUBST(BALANCER_INCLUDE)
......
......@@ -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
......@@ -401,11 +401,15 @@ all-cffiles: slapd $(SLAPD_DYNAMIC_BACKENDS) dynamic_overlays dynamic_pwmods
$(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
......@@ -439,6 +443,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)
......
......@@ -34,7 +34,7 @@ BUILD_OPT = "--enable-wt"
BUILD_MOD = @BUILD_WT@
mod_DEFS = -DSLAPD_IMPORT
MOD_DEFS = @WT_INCS@
MOD_DEFS = @WT_CFLAGS@
MOD_LIBS = @WT_LIBS@
......
[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