]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8707 - Add slapd.service and lloadd.service for systemd
authorSATOH Fumiyasu <fumiyas@osstech.co.jp>
Fri, 11 Aug 2017 10:33:32 +0000 (19:33 +0900)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 20 Apr 2021 22:54:19 +0000 (22:54 +0000)
build/top.mk
configure.ac
servers/lloadd/Makefile_server.in
servers/lloadd/lloadd.service [new file with mode: 0644]
servers/slapd/Makefile.in
servers/slapd/back-wt/Makefile.in
servers/slapd/slapd.service [new file with mode: 0644]

index 4b8efb2b962811582767b6dfbaefd7825fe57448..38ce146d7705ee8e0286673b6b1981d2232a1990 100644 (file)
@@ -45,6 +45,7 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@$(ldap_subdir)
 schemadir = $(sysconfdir)/schema
+systemdsystemunitdir = @systemdsystemunitdir@
 
 PLAT = @PLAT@
 EXEEXT = @EXEEXT@
index 9d13f3aa739c81a6d0d7ec679984aad39a41aba2..6e44acf395711a629226ef773689e99c86f64554 100644 (file)
@@ -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)
index 6964ca5dcc291736096e93b52440b71c70928a98..2e01aa512ec05a024a39b6995a86c77871deb8d3 100644 (file)
@@ -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
diff --git a/servers/lloadd/lloadd.service b/servers/lloadd/lloadd.service
new file mode 100644 (file)
index 0000000..062b8ca
--- /dev/null
@@ -0,0 +1,13 @@
+[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
index cf58cda4f21b9e2080e8057926de984527b0b064..0a3c36de437ee25307e37d2822e678e1093967cd 100644 (file)
@@ -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)
index 1cd2222104fdd48d1cdffe6876526146a247d5b6..4f1f33bcc2dc853b28b8d3b30136834e4cf7c74a 100644 (file)
@@ -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@
 
 
diff --git a/servers/slapd/slapd.service b/servers/slapd/slapd.service
new file mode 100644 (file)
index 0000000..a0599b8
--- /dev/null
@@ -0,0 +1,15 @@
+[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