Makefile.am | 24 ++ Makefile.in | 74 ++++++-- VERSION.sh | 2 aclocal.m4 | 156 +++++++++++++++++ admserv/cfgstuff/initconfig.in | 5 admserv/cgi-src40/restartsrv.c | 7 admserv/newinst/src/AdminServer.pm.in | 8 config.h.in | 3 configure | 298 +++++++++++++++++++++++++++++----- configure.ac | 94 ++++++++-- include/libdsa/dsalib.h | 4 lib/libdsa/dsalib_location.c | 41 ++++ lib/libdsa/dsalib_updown.c | 27 +++ wrappers/systemd.service.in | 24 ++ 14 files changed, 680 insertions(+), 87 deletions(-)
New commits: commit 65e4166066a3d9be541f5f35f6db3fe997d0a190 Author: Rich Megginson rmeggins@redhat.com Date: Wed Apr 20 11:04:26 2011 -0600
Bug 695741 - Providing native systemd file for upcoming F16 Feature Systemd
https://bugzilla.redhat.com/show_bug.cgi?id=695741 Resolves: bug 695741 Bug Description: Providing native systemd file for upcoming F15 Feature Systemd Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: Create a dirsrv-admin.service file for systemd and allow it to use /etc/sysconfig/dirsrv-admin for its EnvironmentFile When using systemd, have to use the systemctl start command in startServer or other systemd commands like status, restart, stop will not work Use systemctl to manage directory server instances too. The old service support did not include the directory server too, so that was added. Platforms tested: Fedora 16 x86_64 Flag Day: yes Doc impact: yes
diff --git a/Makefile.am b/Makefile.am index 792f782..6ba1f3c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,7 +33,10 @@ DEBUG_DEFINES = @debug_defs@ # the -U undefines these symbols - should use the corresponding ADM_ ones instead - see configure.ac OTHER_DEFINES = -DVENDOR=""$(vendor)"" -DBRAND=""$(brand)"" -DCAPBRAND=""$(capbrand)"" \ -DVENDORURL=""$(vendorurl)"" \ - -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT + -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT \ + -DDIRSRV_SYSTEMD_PREFIX=""@dirsrv_systemd_prefix@"" \ + -DDIRSRV_SYSTEMD_SUFFIX=""@dirsrv_systemd_suffix@"" \ + -DDIRSRV_SERVICE_NAME=""@dirsrv_service_name@""
PATH_DEFINES = -DINITCONFIGDIR=""$(initconfigdir)""
@@ -61,6 +64,8 @@ icondir = $(datadir)@icondir@ httpdconf = @httpdconf@ manualdir = $(datadir)@manualdir@ helpdir = $(manualdir)/help +systemdsystemunitdir = @with_systemdsystemunitdir@ +systemddirsrvgroupname = @with_systemddirsrvgroupname@ initdir = @initdir@ initconfigdir = $(sysconfdir)@initconfigdir@ instconfigdir = @instconfigdir@ @@ -182,7 +187,11 @@ selinux-built: selinux-built/dirsrv-admin.fc: selinux-built $(fixupcmd) selinux-built/dirsrv-admin.fc.in > $@
+if SYSTEMD +systemdsystemunit_DATA = wrappers/$(PACKAGE_NAME).service +else init_SCRIPTS = wrappers/$(PACKAGE_NAME) +endif
initconfig_DATA = admserv/cfgstuff/$(PACKAGE_NAME)
@@ -552,6 +561,8 @@ fixupcmd = sed \ -e 's,@updatedir@,$(updatedir),g' \ -e 's,@with_selinux@,@with_selinux@,g' \ -e 's,@enable_service@,@enable_service@,g' \ + -e 's,@systemdsystemunitdir@,$(systemdsystemunitdir),g' \ + -e 's,@systemddirsrvgroupname@,$(systemddirsrvgroupname),g' \ -e 's,@dsgwcgibindir@,$(dsgwcgibindir),g' \ -e 's,@dsgwconfigdir@,$(dsgwconfigdir),g' \ -e 's,@dsgwcookiedir@,$(dsgwcookiedir),g' @@ -612,6 +623,8 @@ fixupcmd = sed \ -e 's,@updatedir@,$(updatedir),g' \ -e 's,@with_selinux@,@with_selinux@,g' \ -e 's,@enable_service@,@enable_service@,g' \ + -e 's,@systemdsystemunitdir@,$(systemdsystemunitdir),g' \ + -e 's,@systemddirsrvgroupname@,$(systemddirsrvgroupname),g' \ -e 's,@dsgwcgibindir@,$(dsgwcgibindir),g' \ -e 's,@dsgwconfigdir@,$(dsgwconfigdir),g' \ -e 's,@dsgwcookiedir@,$(dsgwcookiedir),g' @@ -622,9 +635,9 @@ admserv/cfgstuff/httpd.conf: $(HTTPD_CONF_SRC) if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi $(fixupcmd) $< > $@
-% : %.in +wrappers/$(PACKAGE_NAME).service: $(srcdir)/wrappers/systemd.service.in if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi - $(fixupcmd) $< > $@ + $(fixupcmd) $^ > $@
%/$(PACKAGE_NAME): %/initscript.in if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi @@ -633,3 +646,8 @@ admserv/cfgstuff/httpd.conf: $(HTTPD_CONF_SRC) %/$(PACKAGE_NAME): %/initconfig.in if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi $(fixupcmd) $^ > $@ + +% : %.in + if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi + $(fixupcmd) $< > $@ + diff --git a/Makefile.in b/Makefile.in index da13e44..2caf5aa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -118,7 +118,7 @@ am__installdirs = "$(DESTDIR)$(admmoddir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(infdir)" "$(DESTDIR)$(initconfigdir)" \ "$(DESTDIR)$(ldifdir)" "$(DESTDIR)$(configdir)" \ "$(DESTDIR)$(perldir)" "$(DESTDIR)$(propertydir)" \ - "$(DESTDIR)$(updatedir)" + "$(DESTDIR)$(systemdsystemunitdir)" "$(DESTDIR)$(updatedir)" LTLIBRARIES = $(admmod_LTLIBRARIES) $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libds_admin_serv_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ @@ -279,7 +279,7 @@ MANS = $(dist_man_MANS) DATA = $(dist_help_DATA) $(dist_html_DATA) $(dist_icon_DATA) \ $(inf_DATA) $(initconfig_DATA) $(ldif_DATA) \ $(nodist_config_DATA) $(perl_DATA) $(property_DATA) \ - $(update_DATA) + $(systemdsystemunit_DATA) $(update_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -408,6 +408,9 @@ cmdbindir = $(sbindir) datadir = @datadir@ datarootdir = @datarootdir@ debug_defs = @debug_defs@ +dirsrv_service_name = @dirsrv_service_name@ +dirsrv_systemd_prefix = @dirsrv_systemd_prefix@ +dirsrv_systemd_suffix = @dirsrv_systemd_suffix@ docdir = @docdir@
# needed for selinux policy @@ -494,6 +497,8 @@ updatedir = $(datadir)@updatedir@ vendor = @vendor@ vendorurl = @vendorurl@ with_selinux = @with_selinux@ +with_systemddirsrvgroupname = @with_systemddirsrvgroupname@ +with_systemdsystemunitdir = @with_systemdsystemunitdir@
# BEGIN COPYRIGHT BLOCK # Copyright (C) 2006 Red Hat, Inc. @@ -525,13 +530,18 @@ DEBUG_DEFINES = @debug_defs@ # the -U undefines these symbols - should use the corresponding ADM_ ones instead - see configure.ac OTHER_DEFINES = -DVENDOR=""$(vendor)"" -DBRAND=""$(brand)"" -DCAPBRAND=""$(capbrand)"" \ -DVENDORURL=""$(vendorurl)"" \ - -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT + -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT \ + -DDIRSRV_SYSTEMD_PREFIX=""@dirsrv_systemd_prefix@"" \ + -DDIRSRV_SYSTEMD_SUFFIX=""@dirsrv_systemd_suffix@"" \ + -DDIRSRV_SERVICE_NAME=""@dirsrv_service_name@""
PATH_DEFINES = -DINITCONFIGDIR=""$(initconfigdir)""
# look for included m4 files in the ./m4/ directory ACLOCAL_AMFLAGS = -I m4 helpdir = $(manualdir)/help +systemdsystemunitdir = @with_systemdsystemunitdir@ +systemddirsrvgroupname = @with_systemddirsrvgroupname@ configdir = $(instconfigdir)/$(instancename) # same as configdir for now securitydir = $(configdir) @@ -599,7 +609,8 @@ DEFAULT_LIBS = libds-admin-serv.la $(DEFAULT_LIBS_NOCGI) @CXXLINK_REQUIRED_TRUE@MYLINK = $(CXXLINK) @SELINUX_TRUE@POLICY_FC = selinux-built/dirsrv-admin.fc BUILT_SOURCES = $(POLICY_FC) $(RESOURCE_BUNDLES_ROOT) -init_SCRIPTS = wrappers/$(PACKAGE_NAME) +@SYSTEMD_TRUE@systemdsystemunit_DATA = wrappers/$(PACKAGE_NAME).service +@SYSTEMD_FALSE@init_SCRIPTS = wrappers/$(PACKAGE_NAME) initconfig_DATA = admserv/cfgstuff/$(PACKAGE_NAME) ldif_DATA = admserv/schema/ldif/00nsroot_backend.ldif.tmpl \ admserv/schema/ldif/01nsroot.ldif.tmpl \ @@ -917,6 +928,8 @@ property_DATA = admserv/newinst/src/setup-ds-admin.res \ @BUNDLE_FALSE@ -e 's,@updatedir@,$(updatedir),g' \ @BUNDLE_FALSE@ -e 's,@with_selinux@,@with_selinux@,g' \ @BUNDLE_FALSE@ -e 's,@enable_service@,@enable_service@,g' \ +@BUNDLE_FALSE@ -e 's,@systemdsystemunitdir@,$(systemdsystemunitdir),g' \ +@BUNDLE_FALSE@ -e 's,@systemddirsrvgroupname@,$(systemddirsrvgroupname),g' \ @BUNDLE_FALSE@ -e 's,@dsgwcgibindir@,$(dsgwcgibindir),g' \ @BUNDLE_FALSE@ -e 's,@dsgwconfigdir@,$(dsgwconfigdir),g' \ @BUNDLE_FALSE@ -e 's,@dsgwcookiedir@,$(dsgwcookiedir),g' @@ -986,6 +999,8 @@ property_DATA = admserv/newinst/src/setup-ds-admin.res \ @BUNDLE_TRUE@ -e 's,@updatedir@,$(updatedir),g' \ @BUNDLE_TRUE@ -e 's,@with_selinux@,@with_selinux@,g' \ @BUNDLE_TRUE@ -e 's,@enable_service@,@enable_service@,g' \ +@BUNDLE_TRUE@ -e 's,@systemdsystemunitdir@,$(systemdsystemunitdir),g' \ +@BUNDLE_TRUE@ -e 's,@systemddirsrvgroupname@,$(systemddirsrvgroupname),g' \ @BUNDLE_TRUE@ -e 's,@dsgwcgibindir@,$(dsgwcgibindir),g' \ @BUNDLE_TRUE@ -e 's,@dsgwconfigdir@,$(dsgwconfigdir),g' \ @BUNDLE_TRUE@ -e 's,@dsgwcookiedir@,$(dsgwcookiedir),g' @@ -2255,6 +2270,26 @@ uninstall-propertyDATA: test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(propertydir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(propertydir)" && rm -f $$files +install-systemdsystemunitDATA: $(systemdsystemunit_DATA) + @$(NORMAL_INSTALL) + test -z "$(systemdsystemunitdir)" || $(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" + @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdsystemunitdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(systemdsystemunitdir)" || exit $$?; \ + done + +uninstall-systemdsystemunitDATA: + @$(NORMAL_UNINSTALL) + @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(systemdsystemunitdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(systemdsystemunitdir)" && rm -f $$files install-updateDATA: $(update_DATA) @$(NORMAL_INSTALL) test -z "$(updatedir)" || $(MKDIR_P) "$(DESTDIR)$(updatedir)" @@ -2494,7 +2529,7 @@ check: $(BUILT_SOURCES) all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) \ $(MANS) $(DATA) config.h installdirs: - for dir in "$(DESTDIR)$(admmoddir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cgibindir)" "$(DESTDIR)$(cgibindir)" "$(DESTDIR)$(cmdbindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(cmdbindir)" "$(DESTDIR)$(updatedir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(helpdir)" "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(icondir)" "$(DESTDIR)$(infdir)" "$(DESTDIR)$(initconfigdir)" "$(DESTDIR)$(ldifdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(perldir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(updatedir)"; do \ + for dir in "$(DESTDIR)$(admmoddir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cgibindir)" "$(DESTDIR)$(cgibindir)" "$(DESTDIR)$(cmdbindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(cmdbindir)" "$(DESTDIR)$(updatedir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(helpdir)" "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(icondir)" "$(DESTDIR)$(infdir)" "$(DESTDIR)$(initconfigdir)" "$(DESTDIR)$(ldifdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(perldir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(systemdsystemunitdir)" "$(DESTDIR)$(updatedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -2572,7 +2607,8 @@ install-data-am: install-admmodLTLIBRARIES install-cgibinPROGRAMS \ install-dist_iconDATA install-infDATA install-initSCRIPTS \ install-initconfigDATA install-ldifDATA install-man \ install-nodist_cmdbinSCRIPTS install-nodist_configDATA \ - install-perlDATA install-propertyDATA install-updateDATA \ + install-perlDATA install-propertyDATA \ + install-systemdsystemunitDATA install-updateDATA \ install-updateSCRIPTS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook @@ -2629,7 +2665,8 @@ uninstall-am: uninstall-admmodLTLIBRARIES uninstall-cgibinPROGRAMS \ uninstall-initSCRIPTS uninstall-initconfigDATA \ uninstall-ldifDATA uninstall-libLTLIBRARIES uninstall-man \ uninstall-nodist_cmdbinSCRIPTS uninstall-nodist_configDATA \ - uninstall-perlDATA uninstall-propertyDATA uninstall-updateDATA \ + uninstall-perlDATA uninstall-propertyDATA \ + uninstall-systemdsystemunitDATA uninstall-updateDATA \ uninstall-updateSCRIPTS
uninstall-man: uninstall-man8 @@ -2655,19 +2692,20 @@ uninstall-man: uninstall-man8 install-man install-man8 install-nodist_cmdbinSCRIPTS \ install-nodist_configDATA install-pdf install-pdf-am \ install-perlDATA install-propertyDATA install-ps install-ps-am \ - install-strip install-updateDATA install-updateSCRIPTS \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-admmodLTLIBRARIES uninstall-am \ - uninstall-cgibinPROGRAMS uninstall-cgibinSCRIPTS \ + install-strip install-systemdsystemunitDATA install-updateDATA \ + install-updateSCRIPTS installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-admmodLTLIBRARIES \ + uninstall-am uninstall-cgibinPROGRAMS uninstall-cgibinSCRIPTS \ uninstall-cmdbinSCRIPTS uninstall-dist_helpDATA \ uninstall-dist_htmlDATA uninstall-dist_iconDATA \ uninstall-infDATA uninstall-initSCRIPTS \ uninstall-initconfigDATA uninstall-ldifDATA \ uninstall-libLTLIBRARIES uninstall-man uninstall-man8 \ uninstall-nodist_cmdbinSCRIPTS uninstall-nodist_configDATA \ - uninstall-perlDATA uninstall-propertyDATA uninstall-updateDATA \ + uninstall-perlDATA uninstall-propertyDATA \ + uninstall-systemdsystemunitDATA uninstall-updateDATA \ uninstall-updateSCRIPTS
define NL @@ -2722,9 +2760,9 @@ admserv/cfgstuff/httpd.conf: $(HTTPD_CONF_SRC) if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi $(fixupcmd) $< > $@
-% : %.in +wrappers/$(PACKAGE_NAME).service: $(srcdir)/wrappers/systemd.service.in if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi - $(fixupcmd) $< > $@ + $(fixupcmd) $^ > $@
%/$(PACKAGE_NAME): %/initscript.in if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi @@ -2734,6 +2772,10 @@ admserv/cfgstuff/httpd.conf: $(HTTPD_CONF_SRC) if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi $(fixupcmd) $^ > $@
+% : %.in + if [ ! -d $(dir $@) ] ; then mkdir -p $(dir $@) ; fi + $(fixupcmd) $< > $@ + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/aclocal.m4 b/aclocal.m4 index ef89f4a..d3ba204 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -19,6 +19,162 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])])
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant scott@netsplit.com. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see http://pkg-config.freedesktop.org/.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff --git a/admserv/cfgstuff/initconfig.in b/admserv/cfgstuff/initconfig.in index b94c9cb..646e1b7 100644 --- a/admserv/cfgstuff/initconfig.in +++ b/admserv/cfgstuff/initconfig.in @@ -6,12 +6,17 @@ # hard limits are raised, then use ulimit - uncomment # out the following line and change the value to the # desired value +# note - if using systemd, ulimit won't work - you must edit +# the systemd unit file for directory server to add the +# LimitNOFILE option - see man systemd.exec for more info # ulimit -n 8192
# In order to use SASL/GSSAPI the # server needs to know where to find its keytab # file - uncomment the following line and set # the path and filename appropriately +# if using systemd, omit the "; export VARNAME" at the end # KRB5_KTNAME=@instconfigdir@/admin-serv/keytab ; export KRB5_KTNAME
# other environment settings can be added here too +# if using systemd, omit the "; export VARNAME" at the end diff --git a/admserv/cgi-src40/restartsrv.c b/admserv/cgi-src40/restartsrv.c index f4501cc..6e67d9b 100644 --- a/admserv/cgi-src40/restartsrv.c +++ b/admserv/cgi-src40/restartsrv.c @@ -183,8 +183,11 @@ int main(int argc, char *argv[]) NULL, NULL); break; case 0: -#if defined(ENABLE_SERVICE) - PR_snprintf(line, sizeof(line), "service " PACKAGE_NAME " restart"); +#if defined(WITH_SYSTEMD) + PL_strncpyz(line, sizeof(line), "/bin/systemctl restart " PACKAGE_NAME ".service"); + restart(line); +#elif defined(ENABLE_SERVICE) + PL_strncpyz(line, sizeof(line), "service " PACKAGE_NAME " restart"); restart(line); #else if (util_find_file_in_paths(line, sizeof(line), "restart-ds-admin", CMDBINDIR, "../..", "")) { diff --git a/admserv/newinst/src/AdminServer.pm.in b/admserv/newinst/src/AdminServer.pm.in index a6deb85..d9d7427 100644 --- a/admserv/newinst/src/AdminServer.pm.in +++ b/admserv/newinst/src/AdminServer.pm.in @@ -451,6 +451,8 @@ sub startAdminServer { $setup->msg('restarting_adminserver'); if ("@enable_service@") { $rc = system("service @package_name@ restart > $filename 2>&1"); + } elsif ("@systemdsystemunitdir@") { + $rc = system("/bin/systemctl restart @package_name@.service > $filename 2>&1"); } else { $rc = system("$selinux_cmd @cmdbindir@/restart-ds-admin > $filename 2>&1"); } @@ -458,6 +460,8 @@ sub startAdminServer { $setup->msg('starting_adminserver'); if ("@enable_service@") { $rc = system("service @package_name@ start > $filename 2>&1"); + } elsif ("@systemdsystemunitdir@") { + $rc = system("/bin/systemctl start @package_name@.service > $filename 2>&1"); } else { $rc = system("$selinux_cmd @cmdbindir@/start-ds-admin > $filename 2>&1"); } @@ -587,7 +591,9 @@ sub reconfigAdminServer {
sub stopAdminServer { my $prog = "@sbindir@/stop-ds-admin"; - if ("@enable_service@") { + if ("@with_systemdsystemunitdir@") { + $prog = "/bin/systemctl stop @package_name@.service"; + } elsif ("@enable_service@") { $prog = "service @package_name@ stop"; } elsif (! -x $prog) { debug(1, "stopping admin server: no such program $prog: cannot stop server\n"); diff --git a/config.h.in b/config.h.in index a5e78f8..10be513 100644 --- a/config.h.in +++ b/config.h.in @@ -333,6 +333,9 @@ /* package version */ #undef VERSION
+/* use systemd to stop/start/restart the servers */ +#undef WITH_SYSTEMD + /* UNIX */ #undef XP_UNIX
diff --git a/configure b/configure index 27ea93d..2fe293d 100755 --- a/configure +++ b/configure @@ -790,6 +790,8 @@ ac_default_prefix=/opt/dirsrv ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS +SYSTEMD_FALSE +SYSTEMD_TRUE APACHE22_FALSE APACHE22_TRUE WINNT_FALSE @@ -858,6 +860,7 @@ nspr_libdir nspr_lib nspr_inc enable_service +dirsrv_service_name dslibdir instconfigdir SELINUX_FALSE @@ -867,10 +870,14 @@ nsspcache GENRB ICU_CONFIG ldap_lib_ldif -PKG_CONFIG APR_CONFIG APXS HTTPD +dirsrv_systemd_suffix +dirsrv_systemd_prefix +with_systemddirsrvgroupname +with_systemdsystemunitdir +PKG_CONFIG initconfigdir SOLARIS_FALSE SOLARIS_TRUE @@ -1021,6 +1028,8 @@ enable_rpath with_fhs with_fhs_opt with_initddir +with_systemdsystemunitdir +with_systemddirsrvgroupname with_fortitude with_httpd enable_threading @@ -1065,7 +1074,8 @@ CCC CC CFLAGS CPP -CXXCPP' +CXXCPP +PKG_CONFIG'
# Initialize some variables set by options. @@ -1726,6 +1736,14 @@ Optional Packages: --with-initddir=/path Absolute path (not relative like some of the other options) that should contain the SysV init scripts (default '$(sysconfdir)/rc.d') + --with-systemdsystemunitdir=PATH + Directory for systemd service files (default: + $with_systemdsystemunitdir) + + --with-systemddirsrvgroupname=NAME + Name of group target for directory server (default: + $with_systemddirsrvgroupname) + --with-fortitude=PATH Fortitude root directory (default: $default_fortitudedir) --with-httpd=PATH Full path of Apache binary. Configure will usually @@ -1778,6 +1796,7 @@ Some influential environment variables: CFLAGS C compiler flags CPP C preprocessor CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility
Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -5302,13 +5321,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo ""$as_me:5305: $ac_compile"" >&5) + (eval echo ""$as_me:5324: $ac_compile"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo ""$as_me:5308: $NM \"conftest.$ac_objext\""" >&5) + (eval echo ""$as_me:5327: $NM \"conftest.$ac_objext\""" >&5) (eval "$NM "conftest.$ac_objext"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo ""$as_me:5311: output"" >&5) + (eval echo ""$as_me:5330: output"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6514,7 +6533,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6517 "configure"' > conftest.$ac_ext + echo '#line 6536 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: "$ac_compile"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9079,11 +9098,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:9082: $lt_compile"" >&5) + (eval echo ""$as_me:9101: $lt_compile"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9086: $? = $ac_status" >&5 + echo "$as_me:9105: $? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9418,11 +9437,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:9421: $lt_compile"" >&5) + (eval echo ""$as_me:9440: $lt_compile"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9425: $? = $ac_status" >&5 + echo "$as_me:9444: $? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9523,11 +9542,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:9526: $lt_compile"" >&5) + (eval echo ""$as_me:9545: $lt_compile"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9530: $? = $ac_status" >&5 + echo "$as_me:9549: $? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9578,11 +9597,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:9581: $lt_compile"" >&5) + (eval echo ""$as_me:9600: $lt_compile"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9585: $? = $ac_status" >&5 + echo "$as_me:9604: $? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12381,7 +12400,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12384 "configure" +#line 12403 "configure" #include "confdefs.h"
#if HAVE_DLFCN_H @@ -12477,7 +12496,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12480 "configure" +#line 12499 "configure" #include "confdefs.h"
#if HAVE_DLFCN_H @@ -14497,11 +14516,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:14500: $lt_compile"" >&5) + (eval echo ""$as_me:14519: $lt_compile"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14504: $? = $ac_status" >&5 + echo "$as_me:14523: $? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14596,11 +14615,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:14599: $lt_compile"" >&5) + (eval echo ""$as_me:14618: $lt_compile"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14603: $? = $ac_status" >&5 + echo "$as_me:14622: $? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14648,11 +14667,11 @@ else -e 's:.*FLAGS}{0,1} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo ""$as_me:14651: $lt_compile"" >&5) + (eval echo ""$as_me:14670: $lt_compile"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14655: $? = $ac_status" >&5 + echo "$as_me:14674: $? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20381,6 +20400,187 @@ if test -z "$initconfigdir" ; then fi
+ + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\/]* | ?:[\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\/]* | ?:[\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi +if test -n "$PKG_CONFIG" ; then + default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` +fi +{ $as_echo "$as_me:$LINENO: checking for --with-systemdsystemunitdir" >&5 +$as_echo_n "checking for --with-systemdsystemunitdir... " >&6; } + +# Check whether --with-systemdsystemunitdir was given. +if test "${with_systemdsystemunitdir+set}" = set; then + withval=$with_systemdsystemunitdir; +fi + +if test "$with_systemdsystemunitdir" = yes ; then + if test -n "$default_systemdsystemunitdir" ; then + with_systemdsystemunitdir=$default_systemdsystemunitdir + { $as_echo "$as_me:$LINENO: result: $with_systemdsystemunitdir" >&5 +$as_echo "$with_systemdsystemunitdir" >&6; } + else + { { $as_echo "$as_me:$LINENO: error: You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory" >&5 +$as_echo "$as_me: error: You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory" >&2;} + { (exit 1); exit 1; }; } + fi +elif test "$with_systemdsystemunitdir" = no ; then + with_systemdsystemunitdir= +else + { $as_echo "$as_me:$LINENO: result: $with_systemdsystemunitdir" >&5 +$as_echo "$with_systemdsystemunitdir" >&6; } +fi + + +if test -n "$with_systemdsystemunitdir" ; then + if test -z "$with_systemddirsrvgroupname" ; then + with_systemddirsrvgroupname=$PACKAGE_BASE_NAME.target + fi + { $as_echo "$as_me:$LINENO: checking for --with-systemddirsrvgroupname" >&5 +$as_echo_n "checking for --with-systemddirsrvgroupname... " >&6; } + +# Check whether --with-systemddirsrvgroupname was given. +if test "${with_systemddirsrvgroupname+set}" = set; then + withval=$with_systemddirsrvgroupname; +fi + + if test "$with_systemddirsrvgroupname" = yes ; then + { { $as_echo "$as_me:$LINENO: error: You must specify --with-systemddirsrvgroupname=name.of.group" >&5 +$as_echo "$as_me: error: You must specify --with-systemddirsrvgroupname=name.of.group" >&2;} + { (exit 1); exit 1; }; } + elif test "$with_systemddirsrvgroupname" = no ; then + { { $as_echo "$as_me:$LINENO: error: You must specify --with-systemddirsrvgroupname=name.of.group" >&5 +$as_echo "$as_me: error: You must specify --with-systemddirsrvgroupname=name.of.group" >&2;} + { (exit 1); exit 1; }; } + else + { $as_echo "$as_me:$LINENO: result: $with_systemddirsrvgroupname" >&5 +$as_echo "$with_systemddirsrvgroupname" >&6; } + fi + + +cat >>confdefs.h <<_ACEOF +#define WITH_SYSTEMD 1 +_ACEOF + + dirsrv_systemd_prefix="${PACKAGE_BASE_NAME}@" + dirsrv_systemd_suffix=".service" + + +fi + # Check for fortitude # BEGIN COPYRIGHT BLOCK # Copyright (C) 2007 Red Hat, Inc. @@ -22902,37 +23102,40 @@ $as_echo "$dslibdir" >&6; }
# check for --enable-service # set default value based on availability of the service command -if test -z "$enable_service" ; then - if test -f $sbindir/service ; then - enable_service=yes - elif test -f /sbin/service ; then - enable_service=yes - fi -fi -{ $as_echo "$as_me:$LINENO: checking for --enable-service" >&5 +# don't use service with systemd +if test -z "$with_systemdsystemunitdir" ; then + { $as_echo "$as_me:$LINENO: checking for --enable-service" >&5 $as_echo_n "checking for --enable-service... " >&6; } -# Check whether --enable-service was given. + # Check whether --enable-service was given. if test "${enable_service+set}" = set; then enableval=$enable_service; if test x"$enableval" = xyes ; then - enable_service=yes -else - enable_service= -fi + enable_service=yes + else + enable_service= + fi else enable_service=
fi
- -if test -n "$enable_service" ; then + if test -n "$enable_service" ; then
cat >>confdefs.h <<_ACEOF #define ENABLE_SERVICE 1 _ACEOF
-fi -{ $as_echo "$as_me:$LINENO: result: $enable_service" >&5 + dirsrv_service_name="$PACKAGE_BASE_NAME" + + { $as_echo "$as_me:$LINENO: result: $enable_service" >&5 $as_echo "$enable_service" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi +else + enable_service= +fi +
# installation paths - by default, configure will just # use /usr as the prefix for everything, which means @@ -23092,7 +23295,7 @@ else WINNT_FALSE= fi
- if test $APACHE22; then + if test -n "$APACHE22"; then APACHE22_TRUE= APACHE22_FALSE='#' else @@ -23100,6 +23303,14 @@ else APACHE22_FALSE= fi
+ if test -n "$with_systemdsystemunitdir"; then + SYSTEMD_TRUE= + SYSTEMD_FALSE='#' +else + SYSTEMD_TRUE='#' + SYSTEMD_FALSE= +fi +
# libtool on fedora/rhel contains some gcc-isms which cause problems # if not using gcc (e.g. Forte on Solaris, aCC on HP-UX) @@ -23334,6 +23545,13 @@ $as_echo "$as_me: error: conditional "APACHE22" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${SYSTEMD_TRUE}" && test -z "${SYSTEMD_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional "SYSTEMD" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional "SYSTEMD" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi
: ${CONFIG_STATUS=./config.status} ac_write_fail=0 diff --git a/configure.ac b/configure.ac index 1a438e3..b6a3644 100644 --- a/configure.ac +++ b/configure.ac @@ -244,6 +244,53 @@ if test -z "$initconfigdir" ; then fi AC_SUBST(initconfigdir)
+PKG_PROG_PKG_CONFIG +if test -n "$PKG_CONFIG" ; then + default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` +fi +AC_MSG_CHECKING(for --with-systemdsystemunitdir) +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=PATH], + [Directory for systemd service files (default: $with_systemdsystemunitdir)]) +) +if test "$with_systemdsystemunitdir" = yes ; then + if test -n "$default_systemdsystemunitdir" ; then + with_systemdsystemunitdir=$default_systemdsystemunitdir + AC_MSG_RESULT([$with_systemdsystemunitdir]) + else + AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory]) + fi +elif test "$with_systemdsystemunitdir" = no ; then + with_systemdsystemunitdir= +else + AC_MSG_RESULT([$with_systemdsystemunitdir]) +fi +AC_SUBST(with_systemdsystemunitdir) + +if test -n "$with_systemdsystemunitdir" ; then + if test -z "$with_systemddirsrvgroupname" ; then + with_systemddirsrvgroupname=$PACKAGE_BASE_NAME.target + fi + AC_MSG_CHECKING(for --with-systemddirsrvgroupname) + AC_ARG_WITH([systemddirsrvgroupname], + AS_HELP_STRING([--with-systemddirsrvgroupname=NAME], + [Name of group target for directory server (default: $with_systemddirsrvgroupname)]) + ) + if test "$with_systemddirsrvgroupname" = yes ; then + AC_MSG_ERROR([You must specify --with-systemddirsrvgroupname=name.of.group]) + elif test "$with_systemddirsrvgroupname" = no ; then + AC_MSG_ERROR([You must specify --with-systemddirsrvgroupname=name.of.group]) + else + AC_MSG_RESULT([$with_systemddirsrvgroupname]) + fi + AC_SUBST(with_systemddirsrvgroupname) + AC_DEFINE([WITH_SYSTEMD], [1], [use systemd to stop/start/restart the servers]) + dirsrv_systemd_prefix="${PACKAGE_BASE_NAME}@" + dirsrv_systemd_suffix=".service" + AC_SUBST(dirsrv_systemd_prefix) + AC_SUBST(dirsrv_systemd_suffix) +fi + # Check for fortitude m4_include(m4/fortitude.m4) # Check for web server @@ -301,29 +348,31 @@ AC_MSG_RESULT([$dslibdir])
# check for --enable-service # set default value based on availability of the service command -if test -z "$enable_service" ; then - if test -f $sbindir/service ; then - enable_service=yes - elif test -f /sbin/service ; then - enable_service=yes +# don't use service with systemd +if test -z "$with_systemdsystemunitdir" ; then + AC_MSG_CHECKING(for --enable-service) + AC_ARG_ENABLE(service, + AS_HELP_STRING([--enable-service], + [Use the service command instead of the stop|start|restart scripts]), + [if test x"$enableval" = xyes ; then + enable_service=yes + else + enable_service= + fi], + [enable_service=] + ) + if test -n "$enable_service" ; then + AC_DEFINE([ENABLE_SERVICE], [1], [Use the service command instead of the stop|start|restart scripts]) + dirsrv_service_name="$PACKAGE_BASE_NAME" + AC_SUBST(dirsrv_service_name) + AC_MSG_RESULT([$enable_service]) + else + AC_MSG_RESULT([no]) fi -fi -AC_MSG_CHECKING(for --enable-service) -AC_ARG_ENABLE(service, - AS_HELP_STRING([--enable-service], - [Use the service command instead of the stop|start|restart scripts]), -[if test x"$enableval" = xyes ; then - enable_service=yes else - enable_service= -fi], -[enable_service=] -) -AC_SUBST(enable_service) -if test -n "$enable_service" ; then - AC_DEFINE([ENABLE_SERVICE], [1], [Use the service command instead of the stop|start|restart scripts]) + enable_service= fi -AC_MSG_RESULT([$enable_service]) +AC_SUBST(enable_service)
# installation paths - by default, configure will just # use /usr as the prefix for everything, which means @@ -467,11 +516,12 @@ AC_SUBST(capbrand) AC_SUBST(vendor) AC_SUBST(vendorurl)
-AM_CONDITIONAL(OPENLDAP,test "$with_openldap" = "yes") +AM_CONDITIONAL([OPENLDAP],[test "$with_openldap" = "yes"]) # WINNT should be true if building on Windows system not using # cygnus, mingw, or the like and using cmd.exe as the shell AM_CONDITIONAL([WINNT], false) -AM_CONDITIONAL([APACHE22], test $APACHE22) +AM_CONDITIONAL([APACHE22], [test -n "$APACHE22"]) +AM_CONDITIONAL([SYSTEMD], [test -n "$with_systemdsystemunitdir"])
# libtool on fedora/rhel contains some gcc-isms which cause problems # if not using gcc (e.g. Forte on Solaris, aCC on HP-UX) diff --git a/include/libdsa/dsalib.h b/include/libdsa/dsalib.h index eddf28a..c5696c6 100644 --- a/include/libdsa/dsalib.h +++ b/include/libdsa/dsalib.h @@ -121,9 +121,8 @@ #endif #endif
+/* only used if not WITH_SYSTEMD and not ENABLE_SERVICE */ #define START_SCRIPT "start-slapd" -#define RESTART_SCRIPT "restart-slapd" -#define STOP_SCRIPT "stop-slapd"
#if defined( XP_WIN32 ) #define SLAPD_NAME "slapd" @@ -270,6 +269,7 @@ extern DS_EXPORT_SYMBOL int ds_bring_up_server_install(int verbose, char *root, char *errorlog); extern DS_EXPORT_SYMBOL int ds_bring_up_server(int verbose); extern DS_EXPORT_SYMBOL char *ds_get_server_name(); +extern DS_EXPORT_SYMBOL char *ds_get_short_name(); extern DS_EXPORT_SYMBOL void ds_send_error(char *errstr, int print_errno); extern DS_EXPORT_SYMBOL void ds_send_status(char *str); extern DS_EXPORT_SYMBOL char *ds_get_errors_name(); diff --git a/lib/libdsa/dsalib_location.c b/lib/libdsa/dsalib_location.c index ef2dd5e..e4104da 100644 --- a/lib/libdsa/dsalib_location.c +++ b/lib/libdsa/dsalib_location.c @@ -286,6 +286,47 @@ ds_get_server_name() } }
+/* + * Returns the Directory Server instance name without the "slapd-" prefix + */ +DS_EXPORT_SYMBOL char * +ds_get_short_name() +{ + static char shortname[PATH_MAX] = {0}; + + if (shortname[0]) { + return shortname; + } + + if( getenv("SERVER_NAMES") ) { + char *ptr = strstr(getenv("SERVER_NAMES"), "slapd-"); + if (ptr) { + PL_strncpyz(shortname, ptr+6, sizeof(shortname)); + } else { + PL_strncpyz(shortname, getenv("SERVER_NAMES"), sizeof(shortname)); + } + } else { + char *buf; + char *out = shortname; + buf = getenv("SCRIPT_NAME"); + if (buf) { + buf = strstr(getenv("SCRIPT_NAME"), "slapd-"); + if (buf) { + buf += 6; + while ( buf && *buf && (*buf != '/') ) { + *out++ = *buf++; + } + *out = 0; + } else { + PL_strncpyz(shortname, getenv("SCRIPT_NAME"), sizeof(shortname)); + } + } else { + PL_strncpyz(shortname, getenv("SCRIPT_NAME"), sizeof(shortname)); + } + } + return shortname; +} + DS_EXPORT_SYMBOL char * ds_get_logfile_name(int config_type) { diff --git a/lib/libdsa/dsalib_updown.c b/lib/libdsa/dsalib_updown.c index c3b460c..b9d8f28 100644 --- a/lib/libdsa/dsalib_updown.c +++ b/lib/libdsa/dsalib_updown.c @@ -166,8 +166,17 @@ ds_bring_up_server_install(int verbose, char *instdir, char *errorlog) tmp_dir = ds_get_tmp_dir(); PR_snprintf(statfile, PATH_MAX, "%s%cstartup.%d", tmp_dir, FILE_SEP, (int)getpid());
+#if defined( WITH_SYSTEMD ) + PR_snprintf(startup_line, BIG_LINE, "/bin/systemctl start %s%s%s > %s 2>&1", + DIRSRV_SYSTEMD_PREFIX, ds_get_short_name(), DIRSRV_SYSTEMD_SUFFIX, + statfile); +#elif defined( ENABLE_SERVICE ) + PR_snprintf(startup_line, BIG_LINE, "service %s start %s > %s 2>&1", + DIRSRV_SERVICE_NAME, ds_get_short_name(), statfile); +#else PR_snprintf(startup_line, BIG_LINE, "%s%c%s > %s 2>&1", instdir, FILE_SEP, START_SCRIPT, statfile); +#endif alter_startup_line(startup_line); error = system(startup_line); if (error == -1) @@ -293,6 +302,8 @@ ds_bring_down_server() int status; int cur_size; char *errorlog; + char stop_cmd[BIG_LINE]; + int error;
status = ds_get_updown_status(); /* set server_pid too! */ if ( status != DS_SERVER_UP ) { @@ -308,6 +319,21 @@ ds_bring_down_server()
cur_size = ds_get_file_size(errorlog); #if !defined( XP_WIN32 ) +#if defined( WITH_SYSTEMD ) || defined( ENABLE_SERVICE ) +#if defined( WITH_SYSTEMD ) + PR_snprintf(stop_cmd, sizeof(stop_cmd), "/bin/systemctl stop %s%s%s", + DIRSRV_SYSTEMD_PREFIX, ds_get_short_name(), DIRSRV_SYSTEMD_SUFFIX); +#else + PR_snprintf(stop_cmd, sizeof(stop_cmd), "service %s stop %s", + DIRSRV_SERVICE_NAME, ds_get_short_name()); +#endif + alter_startup_line(stop_cmd); + error = system(stop_cmd); + if (error == -1) + error = DS_SERVER_UNKNOWN; /* could not stop server */ + else + error = DS_SERVER_DOWN; /* stopped server */ +#else /* not systemd or service */ if ( (kill(server_pid, SIGTERM)) != 0) { if (errno == EPERM) { ds_send_error("Not permitted to kill server.", 0); @@ -318,6 +344,7 @@ ds_bring_down_server() } return(DS_SERVER_UNKNOWN); } +#endif #else if ( StopServer() == DS_SERVER_DOWN ) { ds_send_status("shutdown: server shut down"); diff --git a/wrappers/systemd.service.in b/wrappers/systemd.service.in new file mode 100644 index 0000000..186e851 --- /dev/null +++ b/wrappers/systemd.service.in @@ -0,0 +1,24 @@ +# do not edit this file in /lib/systemd/system - instead do the following: +# cp /lib/systemd/system/dirsrv-admin.service /etc/systemd/system/ +# edit /etc/systemd/system/dirsrv-admin.service +# systemctl daemon-reload +# systemctl start dirsrv-admin.service +[Unit] +Description=@capbrand@ Administration Server. +After=syslog.target network.target @systemddirsrvgroupname@ + +[Service] +Type=forking +PIDFile=@localstatedir@/run/@PACKAGE_BASE_NAME@/admin-serv.pid +# to set the kerberos keytab +# Environment=KRB5_KTNAME=@instconfigdir@/myname.keytab +EnvironmentFile=@initconfigdir@/@package_name@ +ExecStart=@HTTPD@ -k start -f @configdir@/httpd.conf +ExecReload=@HTTPD@ -t +ExecReload=/bin/kill -HUP $MAINPID +ExecStop=@HTTPD@ $OPTIONS -k stop +# to raise the file descriptor limit +# LimitNOFILE=8192 + +[Install] +WantedBy=multi-user.target
commit d76e1356da79aa304122beebb3fa1078979eb5cc Author: Rich Megginson rmeggins@redhat.com Date: Fri Sep 2 10:24:03 2011 -0600
bump version to 1.1.24
diff --git a/VERSION.sh b/VERSION.sh index f75e179..214584d 100644 --- a/VERSION.sh +++ b/VERSION.sh @@ -11,7 +11,7 @@ vendorurl=http://port389.org # PACKAGE_VERSION is constructed from these VERSION_MAJOR=1 VERSION_MINOR=1 -VERSION_MAINT=23 +VERSION_MAINT=24 # if this is a PRERELEASE, set VERSION_PREREL # otherwise, comment it out # be sure to include the dot prefix in the prerel
389-commits@lists.fedoraproject.org