summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2007-02-09 22:33:59 +0000
committerRich Megginson <rmeggins@redhat.com>2007-02-09 22:33:59 +0000
commit941a7e89074e2ed0e0401aa778ccf412dce14fc8 (patch)
treec32facb9e9817cbffba8db9b6eda22b9db95b8e4
parent04e615e5a4d68e3c5165eeb4f9c0bfae25547925 (diff)
downloadds-941a7e89074e2ed0e0401aa778ccf412dce14fc8.tar.gz
ds-941a7e89074e2ed0e0401aa778ccf412dce14fc8.tar.xz
ds-941a7e89074e2ed0e0401aa778ccf412dce14fc8.zip
Resolves: bug 160235
Bug Description: Add support for /etc/init scripts Reviewed by: nkinder (Thanks!) Fix Description: Add the new initscript. The initscript is called $PACKAGE_NAME which by default is fedora-ds. This script is created from wrappers/initscript.in, sed'd by the fixupcmd in Makefile.am during make install. The way it works is this: service fedora-ds cmd will execute the cmd on all instances (found in /etc/fedora-ds by default). service fedora-ds cmd instance will execute cmd on only that instance. So if you have /etc/fedora-ds/slapd-foo /etc/fedora-ds/slapd-bar and you do service start fedora-ds it will start up both slapd-foo and slapd-bar. If you do service start fedora-ds bar it will start up only slapd-bar. If you do service start fedora-ds biff you will get an error message. The initdir is platform specific (e.g. /etc/rc.d/init.d on linux, /etc/init.d on Solaris) so the definition was added to the platform dependent section of configure.ac. The init script is explicitly branded, including the filename. I needed to add support to the autotool files so that we could change the name of the file. Since package_name is defined when you use the AC_INIT macro in configure.ac, we don't need to define it elsewhere (e.g. #define BRAND_DS). So I added the branding and other information to the autotool files, and changed create_instance to use package_name instead of brand_ds to be consistent. Having the package_name defined in much fewer places should make it much easier to change in the future if necessary. I also fixed a compiler warning in ldaprot.h. Platforms tested: RHEL4, FC6 Flag Day: no Doc impact: Yes. We need to document how to use the initscript, and how to enable startup on boot - chkconfig fedora-ds on
-rw-r--r--Makefile.am11
-rw-r--r--Makefile.in54
-rwxr-xr-xconfigure46
-rw-r--r--configure.ac25
-rw-r--r--ldap/admin/src/create_instance.c56
-rw-r--r--ldap/admin/src/create_instance.h6
-rw-r--r--ldap/admin/src/ds_newinst.pl.in8
-rw-r--r--ldap/include/ldaprot.h8
-rw-r--r--wrappers/initscript.in247
9 files changed, 384 insertions, 77 deletions
diff --git a/Makefile.am b/Makefile.am
index aa04d689..9de30eec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,6 +66,7 @@ schemadir = $(sysconfdir)@schemadir@
serverdir = $(libdir)@serverdir@
serverplugindir = $(libdir)@serverplugindir@
taskdir = $(datadir)@scripttemplatedir@
+initdir = $(sysconfdir)@initdir@
#------------------------
# Build Products
@@ -173,6 +174,8 @@ task_SCRIPTS = ldap/admin/src/scripts/template-bak2db \
$(srcdir)/ldap/admin/src/scripts/template-migrateInstance7 \
$(srcdir)/ldap/admin/src/scripts/template-migrateTo7
+init_SCRIPTS = wrappers/$(PACKAGE_NAME)
+
#////////////////////////////////////////////////////////////////
#
# Server Strings
@@ -942,8 +945,14 @@ fixupcmd = sed \
-e 's,@serverdir\@,$(serverdir),g' \
-e 's,@serverplugindir\@,$(serverplugindir),g' \
-e 's,@taskdir\@,$(taskdir),g' \
- -e 's,@configdir\@,$(configdir),g'
+ -e 's,@configdir\@,$(configdir),g' \
+ -e 's,@sysconfdir\@,$(sysconfdir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ -e 's,@package_name\@,$(PACKAGE_NAME),g'
%: %.in
mkdir -p $(dir $@)
$(fixupcmd) $^ > $@
+
+%/$(PACKAGE_NAME): %/initscript.in
+ $(fixupcmd) $^ > $@
diff --git a/Makefile.in b/Makefile.in
index d6619fd6..0a014255 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -94,9 +94,9 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(serverdir)" \
"$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" \
- "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" \
- "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" \
- "$(DESTDIR)$(schemadir)"
+ "$(DESTDIR)$(initdir)" "$(DESTDIR)$(taskdir)" \
+ "$(DESTDIR)$(configdir)" "$(DESTDIR)$(propertydir)" \
+ "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"
serverLTLIBRARIES_INSTALL = $(INSTALL)
serverpluginLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(server_LTLIBRARIES) $(serverplugin_LTLIBRARIES)
@@ -677,8 +677,9 @@ rsearch_bin_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+initSCRIPT_INSTALL = $(INSTALL_SCRIPT)
taskSCRIPT_INSTALL = $(INSTALL_SCRIPT)
-SCRIPTS = $(bin_SCRIPTS) $(task_SCRIPTS)
+SCRIPTS = $(bin_SCRIPTS) $(init_SCRIPTS) $(task_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -879,6 +880,7 @@ icu_inc = @icu_inc@
icu_lib = @icu_lib@
includedir = @includedir@
infodir = @infodir@
+initdir = $(sysconfdir)@initdir@
install_sh = @install_sh@
ldapsdk_bindir = @ldapsdk_bindir@
ldapsdk_inc = @ldapsdk_inc@
@@ -1059,6 +1061,7 @@ task_SCRIPTS = ldap/admin/src/scripts/template-bak2db \
$(srcdir)/ldap/admin/src/scripts/template-migrateInstance7 \
$(srcdir)/ldap/admin/src/scripts/template-migrateTo7
+init_SCRIPTS = wrappers/$(PACKAGE_NAME)
#////////////////////////////////////////////////////////////////
#
@@ -1805,7 +1808,10 @@ fixupcmd = sed \
-e 's,@serverdir\@,$(serverdir),g' \
-e 's,@serverplugindir\@,$(serverplugindir),g' \
-e 's,@taskdir\@,$(taskdir),g' \
- -e 's,@configdir\@,$(configdir),g'
+ -e 's,@configdir\@,$(configdir),g' \
+ -e 's,@sysconfdir\@,$(sysconfdir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ -e 's,@package_name\@,$(PACKAGE_NAME),g'
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -3612,6 +3618,25 @@ uninstall-binSCRIPTS:
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
+install-initSCRIPTS: $(init_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(initdir)" || $(mkdir_p) "$(DESTDIR)$(initdir)"
+ @list='$(init_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(initSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(initdir)/$$f'"; \
+ $(initSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(initdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-initSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(init_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(initdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(initdir)/$$f"; \
+ done
install-taskSCRIPTS: $(task_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(taskdir)" || $(mkdir_p) "$(DESTDIR)$(taskdir)"
@@ -8826,7 +8851,7 @@ check: $(BUILT_SOURCES)
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) \
$(DATA) config.h
installdirs:
- for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"; do \
+ for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -8952,10 +8977,10 @@ info: info-am
info-am:
-install-data-am: install-configDATA install-nodist_propertyDATA \
- install-sampledataDATA install-schemaDATA \
- install-serverLTLIBRARIES install-serverpluginLTLIBRARIES \
- install-taskSCRIPTS
+install-data-am: install-configDATA install-initSCRIPTS \
+ install-nodist_propertyDATA install-sampledataDATA \
+ install-schemaDATA install-serverLTLIBRARIES \
+ install-serverpluginLTLIBRARIES install-taskSCRIPTS
install-exec-am: install-binPROGRAMS install-binSCRIPTS \
install-sbinPROGRAMS
@@ -8987,7 +9012,7 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
- uninstall-configDATA uninstall-info-am \
+ uninstall-configDATA uninstall-info-am uninstall-initSCRIPTS \
uninstall-nodist_propertyDATA uninstall-sampledataDATA \
uninstall-sbinPROGRAMS uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverpluginLTLIBRARIES \
@@ -9004,7 +9029,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-binSCRIPTS install-configDATA \
install-data install-data-am install-exec install-exec-am \
- install-info install-info-am install-man \
+ install-info install-info-am install-initSCRIPTS install-man \
install-nodist_propertyDATA install-sampledataDATA \
install-sbinPROGRAMS install-schemaDATA \
install-serverLTLIBRARIES install-serverpluginLTLIBRARIES \
@@ -9013,7 +9038,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \
- uninstall-configDATA uninstall-info-am \
+ uninstall-configDATA uninstall-info-am uninstall-initSCRIPTS \
uninstall-nodist_propertyDATA uninstall-sampledataDATA \
uninstall-sbinPROGRAMS uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverpluginLTLIBRARIES \
@@ -9035,6 +9060,9 @@ ns-slapd.properties: makstrdb
%: %.in
mkdir -p $(dir $@)
$(fixupcmd) $^ > $@
+
+%/$(PACKAGE_NAME): %/initscript.in
+ $(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/configure b/configure
index 13179670..c6258daa 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for fedora-ds 1.1.
+# Generated by GNU Autoconf 2.59 for fedora-ds 1.1.0.
#
# Report bugs to <http://bugzilla.redhat.com/>.
#
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='fedora-ds'
PACKAGE_TARNAME='fedora-ds'
-PACKAGE_VERSION='1.1'
-PACKAGE_STRING='fedora-ds 1.1'
+PACKAGE_VERSION='1.1.0'
+PACKAGE_STRING='fedora-ds 1.1.0'
PACKAGE_BUGREPORT='http://bugzilla.redhat.com/'
# Factoring default headers for most tests.
@@ -464,8 +464,8 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_default_prefix=/opt/fedora-ds
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link LTLIBOBJS'
+ac_default_prefix=/opt/$PACKAGE_NAME
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL initdir SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures fedora-ds 1.1 to adapt to many kinds of systems.
+\`configure' configures fedora-ds 1.1.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1020,7 +1020,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of fedora-ds 1.1:";;
+ short | recursive ) echo "Configuration of fedora-ds 1.1.0:";;
esac
cat <<\_ACEOF
@@ -1186,7 +1186,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-fedora-ds configure 1.1
+fedora-ds configure 1.1.0
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1200,7 +1200,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by fedora-ds $as_me 1.1, which was
+It was created by fedora-ds $as_me 1.1.0, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1846,7 +1846,7 @@ fi
# Define the identity of the package.
PACKAGE='fedora-ds'
- VERSION='1.1'
+ VERSION='1.1.0'
cat >>confdefs.h <<_ACEOF
@@ -22887,19 +22887,19 @@ if test "$with_fhs" = "yes"; then
fi
# relative to sysconfdir
-configdir=/fedora-ds/config
+configdir=/$PACKAGE_NAME/config
# relative to datadir
-sampledatadir=/fedora-ds/data
+sampledatadir=/$PACKAGE_NAME/data
# relative to sysconfdir
-propertydir=/fedora-ds/property
+propertydir=/$PACKAGE_NAME/property
# relative to sysconfdir
-schemadir=/fedora-ds/schema
+schemadir=/$PACKAGE_NAME/schema
# relative to libdir
-serverdir=/fedora-ds
+serverdir=/$PACKAGE_NAME
# relative to libdir
-serverplugindir=/fedora-ds/plugins
+serverplugindir=/$PACKAGE_NAME/plugins
# relative to datadir
-scripttemplatedir=/fedora-ds/script-templates
+scripttemplatedir=/$PACKAGE_NAME/script-templates
@@ -22922,6 +22922,8 @@ fi
# Deal with platform dependent defines
+# relative to sysconfdir
+initdir=/rc.d
case $host in
*-*-linux*)
@@ -22955,6 +22957,8 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
platform="linux"
+ # relative to sysconfdir
+ initdir=/rc.d/init.d
;;
ia64-hp-hpux*)
@@ -23098,6 +23102,8 @@ _ACEOF
LIBDL=$LIBDL
platform="solaris"
+ # relative to sysconfdir
+ initdir=/init.d
;;
*)
platform=""
@@ -23106,6 +23112,7 @@ esac
+
if test "$platform" = "solaris"; then
SOLARIS_TRUE=
SOLARIS_FALSE='#'
@@ -25259,7 +25266,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by fedora-ds $as_me 1.1, which was
+This file was extended by fedora-ds $as_me 1.1.0, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -25322,7 +25329,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-fedora-ds config.status 1.1
+fedora-ds config.status 1.1.0
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -25603,6 +25610,7 @@ s,@WINNT_FALSE@,$WINNT_FALSE,;t t
s,@LIBSOCKET@,$LIBSOCKET,;t t
s,@LIBNSL@,$LIBNSL,;t t
s,@LIBDL@,$LIBDL,;t t
+s,@initdir@,$initdir,;t t
s,@SOLARIS_TRUE@,$SOLARIS_TRUE,;t t
s,@SOLARIS_FALSE@,$SOLARIS_FALSE,;t t
s,@PKG_CONFIG@,$PKG_CONFIG,;t t
diff --git a/configure.ac b/configure.ac
index 729620d4..4426c0f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT([fedora-ds], [1.1], [http://bugzilla.redhat.com/])
+AC_INIT([fedora-ds], [1.1.0], [http://bugzilla.redhat.com/])
# AC_CONFIG_HEADER must be called right after AC_INIT.
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.9 foreign subdir-objects])
@@ -59,7 +59,7 @@ AC_ARG_ENABLE(debug, [ --enable-debug Enable debug features],
])
AC_SUBST([debug_defs])
-AC_PREFIX_DEFAULT([/opt/fedora-ds])
+AC_PREFIX_DEFAULT([/opt/$PACKAGE_NAME])
# installation paths - by default, configure will just
# use /usr as the prefix for everything, which means
@@ -75,19 +75,19 @@ dnl as opposed to the default /usr/var
fi
# relative to sysconfdir
-configdir=/fedora-ds/config
+configdir=/$PACKAGE_NAME/config
# relative to datadir
-sampledatadir=/fedora-ds/data
+sampledatadir=/$PACKAGE_NAME/data
# relative to sysconfdir
-propertydir=/fedora-ds/property
+propertydir=/$PACKAGE_NAME/property
# relative to sysconfdir
-schemadir=/fedora-ds/schema
+schemadir=/$PACKAGE_NAME/schema
# relative to libdir
-serverdir=/fedora-ds
+serverdir=/$PACKAGE_NAME
# relative to libdir
-serverplugindir=/fedora-ds/plugins
+serverplugindir=/$PACKAGE_NAME/plugins
# relative to datadir
-scripttemplatedir=/fedora-ds/script-templates
+scripttemplatedir=/$PACKAGE_NAME/script-templates
AC_SUBST(configdir)
AC_SUBST(sampledatadir)
AC_SUBST(propertydir)
@@ -101,6 +101,8 @@ AC_SUBST(scripttemplatedir)
AM_CONDITIONAL([WINNT], false)
# Deal with platform dependent defines
+# relative to sysconfdir
+initdir=/rc.d
case $host in
*-*-linux*)
AC_DEFINE([XP_UNIX], [1], [UNIX])
@@ -110,6 +112,8 @@ case $host in
AC_DEFINE([LINUX2_2], [1], [Linux 2.2])
AC_DEFINE([LINUX2_4], [1], [Linux 2.4])
platform="linux"
+ # relative to sysconfdir
+ initdir=/rc.d/init.d
;;
ia64-hp-hpux*)
AC_DEFINE([XP_UNIX], [1], [UNIX])
@@ -150,11 +154,14 @@ case $host in
LIBDL=-ldl
AC_SUBST([LIBDL], [$LIBDL])
platform="solaris"
+ # relative to sysconfdir
+ initdir=/init.d
;;
*)
platform=""
;;
esac
+AC_SUBST(initdir)
AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris")
diff --git a/ldap/admin/src/create_instance.c b/ldap/admin/src/create_instance.c
index dc2a599e..8da5696b 100644
--- a/ldap/admin/src/create_instance.c
+++ b/ldap/admin/src/create_instance.c
@@ -709,7 +709,7 @@ char *gen_script_auto(char *s_root, char *cs_path,
}
PR_snprintf(ofn, sizeof(ofn), "%s%c%s%cscript-templates%ctemplate-%s",
- cf->datadir, FILE_PATHSEP, cf->brand_ds,
+ cf->datadir, FILE_PATHSEP, cf->package_name,
FILE_PATHSEP, FILE_PATHSEP, name);
PR_snprintf(fn, sizeof(fn), "%s%c%s", cs_path, FILE_PATHSEP, name);
create_instance_mkdir(cs_path, NEWDIR_MODE);
@@ -724,7 +724,7 @@ char *gen_script_auto(char *s_root, char *cs_path,
table[0][0] = "DS-ROOT";
table[0][1] = cf->prefix;
table[1][0] = "DS-BRAND";
- table[1][1] = cf->brand_ds;
+ table[1][1] = cf->package_name;
table[2][0] = "SEP";
table[2][1] = FILE_PATHSEPP;
table[3][0] = "SERVER-NAME";
@@ -3419,13 +3419,13 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
/* install certmap.conf at <configdir> */
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/certmap.conf",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
PR_snprintf(dest, sizeof(dest), "%s/certmap.conf", cf->config_dir);
create_instance_copy(src, dest, 0600, 0 );
/* generate <confdir>/slapd-collations.conf */
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/%s-collations.conf",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds,
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name,
FILE_PATHSEP, PRODUCT_NAME);
PR_snprintf(dest, sizeof(dest), "%s%c%s-collations.conf",
cf->config_dir, FILE_PATHSEP, PRODUCT_NAME);
@@ -3448,16 +3448,16 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fclose(f);
/*
- * <sysconfdir>/BRAND_DS/schema to schema_dir
+ * <sysconfdir>/PACKAGE_NAME/schema to schema_dir
*/
PR_snprintf(src, sizeof(src), "%s%c%s%cschema",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
return t;
#if defined (BUILD_PRESENCE)
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/presence",
- cf->sysconfdir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
PR_snprintf(dest, sizeof(dest), "%s/presence", cf->config_dir);
if (t = ds_copy_group_files(src, dest, 0))
return t;
@@ -4234,7 +4234,7 @@ set_path_attribute(char *attr, char *defaultval, char *prefix)
/*
* FHS description
* cf->prefix: %{_prefix}
- * cf->sroot: %{_libdir}/BRAND_DS
+ * cf->sroot: %{_libdir}/PACKAGE_NAME
* cf->localstatedir: %{_localstatedir}
* cf->sysconfdir: %{_sysconfdir}
* cf->bindir: %{_bindir}
@@ -4242,16 +4242,16 @@ set_path_attribute(char *attr, char *defaultval, char *prefix)
* cf->datadir: %{_datadir}
* cf->docdir: %{_docdir}
* cf->inst_dir: <sroot>/slapd-<servid>
- * cf->config_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>
- * cf->schema_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>/schema
- * cf->lock_dir: <localstatedir>/lock/BRAND_DS/slapd-<servid>
- * cf->log_dir: <localstatedir>/log/BRAND_DS/slapd-<servid>
- * cf->run_dir: <localstatedir>/run/BRAND_DS (slapd-instance.pid slapd-instance.startpid files)
- * cf->db_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>/db
- * cf->bak_dir: <localstatedir>/lib/BRAND_DS/slapd-<servid>/bak
- * cf->tmp_dir: <localstatedir>/tmp/BRAND_DS/slapd-<servid>
+ * cf->config_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>
+ * cf->schema_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>/schema
+ * cf->lock_dir: <localstatedir>/lock/PACKAGE_NAME/slapd-<servid>
+ * cf->log_dir: <localstatedir>/log/PACKAGE_NAME/slapd-<servid>
+ * cf->run_dir: <localstatedir>/run/PACKAGE_NAME (slapd-instance.pid slapd-instance.startpid files)
+ * cf->db_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>/db
+ * cf->bak_dir: <localstatedir>/lib/PACKAGE_NAME/slapd-<servid>/bak
+ * cf->tmp_dir: <localstatedir>/tmp/PACKAGE_NAME/slapd-<servid>
* cf->ldif_dir: <datadir>/<brand-ds>/ldif
- * cf->cert_dir: <sysconfdir>/BRAND_DS/slapd-<servid>
+ * cf->cert_dir: <sysconfdir>/PACKAGE_NAME/slapd-<servid>
* cf->sasl_path: <sroot>/sasl2
* cf->plugin_dir: <sroot>/plugins
*
@@ -4274,7 +4274,7 @@ int parse_form(server_config_s *cf)
int prefixlen = 0;
LDAPURLDesc *desc = 0;
- cf->brand_ds = BRAND_DS;
+ cf->package_name = PACKAGE_NAME;
if (rm && qs && !strcmp(rm, "GET"))
{
ds_get_begin(qs);
@@ -4301,7 +4301,7 @@ int parse_form(server_config_s *cf)
}
cf->sroot = PR_smprintf("%s%s%c%s",
- prefix, LIBDIR, FILE_PATHSEP, cf->brand_ds);
+ prefix, LIBDIR, FILE_PATHSEP, cf->package_name);
temp = ds_a_get_cgi_var("sasl_path", NULL, NULL);
if (NULL != temp) {
/* if sasl_path is given, we set it in the conf file regardless of
@@ -4487,7 +4487,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->config_dir = PR_smprintf("%s%c%s%c%s-%s",
cf->sysconfdir, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->config_dir = PL_strdup(temp);
@@ -4500,7 +4500,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->schema_dir = PR_smprintf("%s%c%s%c%s-%s%cschema",
cf->sysconfdir, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid, FILE_PATHSEP);
} else {
cf->schema_dir = PL_strdup(temp);
@@ -4510,7 +4510,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->lock_dir = PR_smprintf("%s%clock%c%s%c%s-%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->lock_dir = PL_strdup(temp);
@@ -4520,7 +4520,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->log_dir = PR_smprintf("%s%clog%c%s%c%s-%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->log_dir = PL_strdup(temp);
@@ -4530,7 +4530,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->run_dir = PR_smprintf("%s%crun%c%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds);
+ cf->package_name);
} else {
cf->run_dir = PL_strdup(temp);
}
@@ -4541,7 +4541,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->db_dir = PR_smprintf("%s%clib%c%s%c%s-%s%cdb",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid, FILE_PATHSEP);
} else {
cf->db_dir = PL_strdup(temp);
@@ -4551,7 +4551,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->bak_dir = PR_smprintf("%s%clib%c%s%c%s-%s%cbak",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid, FILE_PATHSEP);
} else {
cf->bak_dir = PL_strdup(temp);
@@ -4562,7 +4562,7 @@ int parse_form(server_config_s *cf)
temp = ds_a_get_cgi_var("ldif_dir", NULL, NULL);
if (NULL == temp) {
cf->ldif_dir = PR_smprintf("%s%c%s%cldif",
- cf->datadir, FILE_PATHSEP, cf->brand_ds, FILE_PATHSEP);
+ cf->datadir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
} else {
cf->ldif_dir = PL_strdup(temp);
}
@@ -4571,7 +4571,7 @@ int parse_form(server_config_s *cf)
if (NULL == temp) {
cf->tmp_dir = PR_smprintf("%s%ctmp%c%s%c%s-%s",
cf->localstatedir, FILE_PATHSEP, FILE_PATHSEP,
- cf->brand_ds, FILE_PATHSEP,
+ cf->package_name, FILE_PATHSEP,
PRODUCT_NAME, cf->servid);
} else {
cf->tmp_dir = PL_strdup(temp);
diff --git a/ldap/admin/src/create_instance.h b/ldap/admin/src/create_instance.h
index 7629f8c6..27f9bdaf 100644
--- a/ldap/admin/src/create_instance.h
+++ b/ldap/admin/src/create_instance.h
@@ -54,8 +54,8 @@
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
-#ifndef BRAND_DS
-#define BRAND_DS "fedora-ds"
+#ifndef PACKAGE_NAME
+#define PACKAGE_NAME "fedora-ds"
#endif
#ifdef XP_UNIX
@@ -121,7 +121,7 @@ typedef struct {
char *datadir;
char *docdir;
- char *brand_ds;
+ char *package_name;
char *lang;
char *servname;
diff --git a/ldap/admin/src/ds_newinst.pl.in b/ldap/admin/src/ds_newinst.pl.in
index 97bfe972..44fb6a31 100644
--- a/ldap/admin/src/ds_newinst.pl.in
+++ b/ldap/admin/src/ds_newinst.pl.in
@@ -165,7 +165,7 @@ close IN;
# next, construct a hash table with our arguments
my %cgiargs = ();
-my $brand_ds = "fedora-ds";
+my $package_name = "@package_name@";
# the following items are always required
addAndCheck(\%cgiargs, "sroot", \%table, "General", "ServerRoot");
@@ -238,8 +238,8 @@ if ($table{General}->{prefix}) {
}
$cgiargs{prefix} = $prefix;
-if ($table{General}->{BrandDs}) {
- $brand_ds = $table{General}->{BrandDs};
+if ($table{General}->{PackageName}) {
+ $package_name = $table{General}->{PackageName};
}
# populate the DS with this file - the suffix in this file must
@@ -256,7 +256,7 @@ my $sroot = $cgiargs{sroot};
my $prog = "@bindir@/ds_newinst";
if (! -x $prog) {
- $prog = "@libdir@/$brand_ds/ds_newinst";
+ $prog = "@libdir@/$package_name/ds_newinst";
}
my $rc = &cgiFake($sroot, $verbose,
diff --git a/ldap/include/ldaprot.h b/ldap/include/ldaprot.h
index 81cb9e9d..aa7b5139 100644
--- a/ldap/include/ldaprot.h
+++ b/ldap/include/ldaprot.h
@@ -47,10 +47,18 @@
extern "C" {
#endif
+#ifndef LDAP_VERSION1
#define LDAP_VERSION1 1
+#endif
+#ifndef LDAP_VERSION2
#define LDAP_VERSION2 2
+#endif
+#ifndef LDAP_VERSION3
#define LDAP_VERSION3 3
+#endif
+#ifndef LDAP_VERSION
#define LDAP_VERSION LDAP_VERSION2
+#endif
#define COMPAT20
#define COMPAT30
diff --git a/wrappers/initscript.in b/wrappers/initscript.in
new file mode 100644
index 00000000..6c69e309
--- /dev/null
+++ b/wrappers/initscript.in
@@ -0,0 +1,247 @@
+#!/bin/bash
+#
+# @package_name@ This starts and stops @package_name@
+#
+# chkconfig: - 21 79
+# description: @package_name@ Directory Server
+# processname: @sbindir@/ns-slapd
+# configdir: @sysconfdir@/@package_name@/
+# piddir: @localstatedir@/run/@package_name@
+# datadir: @localstatedir@/lib/@package_name@/slapd-<instance name>
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if [ ${NETWORKING} = "no" ]
+then
+ echo "Networking is down"
+ exit 0
+fi
+
+
+exec="@sbindir@/ns-slapd"
+prog="@package_name@"
+# Lockfile
+lockfile="@localstatedir@/lock/subsys/@package_name@"
+# PID directory
+piddir="@localstatedir@/run/@package_name@"
+# Instance basedir
+instbase="@sysconfdir@/@package_name@"
+
+
+[ -f $exec ] || exit 0
+
+
+umask 077
+
+pids=$(pidof $exec)
+
+INSTANCES=""
+
+for FILE in `/bin/ls -d $instbase/slapd-* 2>/dev/null`; do
+ INSTANCES+=$(echo "$FILE" | sed -e "s|$instbase/slapd-||")
+ INSTANCES+=" "
+done
+
+if [ -n "$2" ]; then
+ for I in $INSTANCES; do
+ if [ "$2" == "$I" ]; then
+ INSTANCES="$2"
+ fi
+ done
+ if [ "$2" != "$INSTANCES" ]; then
+ echo -n "$2 is an invalid @package_name@ instance"
+ failure; echo
+ exit 1
+ fi
+fi
+
+start() {
+ if [ -n "$INSTANCES" ]; then
+ export LD_LIBRARY_PATH=@libdir@/@package_name@:@nss_libdir@
+ echo "Starting $prog: "
+ # Start every slapd instance that isn't already running
+ errors=0
+ successes=0
+ for instance in $INSTANCES; do
+ echo -n " $instance..."
+ # the server creates pidfile and writes the pid to it when it is fully
+ # started and available to serve clients
+ pidfile=$piddir/slapd-$instance.pid
+ # the server creates startpidfile and writes the pid to just after
+ # the process begins i.e. it received the startup request and didn't
+ # die a horrible death (e.g. shared lib problem, oom, etc.)
+ startpidfile=$piddir/slapd-$instance.startpid
+ server_running=0
+ if [ -e $pidfile ]; then
+ pid=$(cat $pidfile)
+ if [ $(echo "$pids" | grep -c $pid) -ge 1 ]; then
+ echo -n " already running"
+ success; echo
+ let successes=successes+1
+ server_running=1
+ else
+ echo -n " not running, but pid file exists - attempt to start anyway..."
+ rm -f $pidfile
+ fi
+ fi
+ server_started=0
+ if [ $server_running -eq 0 ] ; then
+ rm -f $pidfile
+ rm -f $startpidfile
+ $exec -D $instbase/slapd-$instance -i $pidfile -w $startpidfile
+ if [ $? -eq 0 ]; then
+ server_started=1 # well, perhaps not running, but started ok
+ else
+ failure; echo
+ let errors=errors+1
+ fi
+ fi
+ # ok, if we started the server successfully, let's see if it is really
+ # running and ready to serve requests
+ if [ $server_started -eq 1 ] ; then
+ loop_counter=1
+ # wait for 10 seconds for the start pid file to appear
+ max_count=10
+ while test $loop_counter -le $max_count; do
+ loop_counter=`expr $loop_counter + 1`
+ if test ! -f $startpidfile ; then
+ sleep 1
+ else
+ pid=`cat $startpidfile`
+ fi
+ done
+ if test ! -f $startpidfile ; then
+ failure; echo
+ let errors=errors+1
+ server_started=0
+ fi
+ fi
+ # ok, server wrote the startpid file - let's see if it comes up
+ # ready to service requests
+ if [ $server_started -eq 1 ] ; then
+ loop_counter=1
+ # wait for 10 minutes (600 times 1 seconds)
+ max_count=600
+ while test $loop_counter -le $max_count ; do
+ loop_counter=`expr $loop_counter + 1`
+ if test ! -f $pidfile ; then
+ if kill -0 $pid > /dev/null 2>&1 ; then
+ sleep 1
+ else
+ break
+ fi
+ else
+ pid=`cat $pidfile`
+ break
+ fi
+ done
+ if kill -0 $pid > /dev/null 2>&1 && test -f $pidfile ; then
+ success; echo
+ let successes=successes+1
+ else
+ failure; echo
+ let errors=errors+1
+ fi
+ fi
+ rm -f $startpidfile
+ done
+ if [ $successes -ge 1 ]; then
+ touch $lockfile
+ fi
+ if [ $errors -ge 1 ]; then
+ echo "*** Warning: $errors instance(s) failed to start"
+ fi
+ else
+ echo "*** Error: no $prog instances configured"
+ fi
+}
+
+stop() {
+ echo "Shutting down $prog: "
+ errors=0
+ for instance in $INSTANCES; do
+ pidfile=$piddir/slapd-$instance.pid
+ if [ -e $pidfile ]; then
+ pid=$(cat $pidfile)
+ echo -n " $instance..."
+ server_stopped=0
+ if [ $(echo "$pids" | grep -c $pid) -ge 1 ]; then
+ kill $pid
+ if [ $? -eq 0 ]; then
+ server_stopped=1
+ else
+ failure; echo
+ let errors=errors+1
+ fi
+ fi
+ if [ $server_stopped -eq 1 ] ; then
+ loop_counter=1
+ # wait for 10 minutes (600 times 1 second)
+ max_count=600
+ while test $loop_counter -le $max_count; do
+ loop_counter=`expr $loop_counter + 1`
+ if kill -0 $pid > /dev/null 2>&1 ; then
+ sleep 1
+ else
+ if test -f $pidfile ; then
+ rm -f $pidfile
+ fi
+ break
+ fi
+ done
+ if test -f $pidfile ; then
+ failure; echo
+ let errors=errors+1
+ else
+ success; echo
+ rm -f $pidfile
+ fi
+ fi
+ fi
+ done
+ if [ $errors -ge 1 ]; then
+ echo -n "*** Error: $errors instance(s) unsuccessfully stopped"
+ failure; echo
+ else
+ rm -f $lockfile
+ fi
+}
+
+restart() {
+ stop
+ start
+}
+
+
+status() {
+ for instance in $INSTANCES; do
+ if [ -e $piddir/slapd-$instance.pid ]; then
+ pid=$(cat $piddir/slapd-$instance.pid)
+ if [ $(echo "$pids" | grep -c $pid) -ge 1 ]; then
+ echo "$prog $instance (pid $pid) is running..."
+ else
+ echo "$prog $instance dead but pid file exists"
+ fi
+ else
+ echo "$prog $instance is stopped"
+ fi
+ done
+}
+
+
+case "$1" in
+ start|stop|restart|reload|status)
+ $1
+ ;;
+ condrestart)
+ [ ! -f $lockfile ] || restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart} [instance-name]"
+ exit 2
+esac