FreeBSD Port: openldap-server-2.4.10
Mikhail Goriachev
mikhailg at webanoide.org
Thu Jul 10 22:23:20 UTC 2008
Quoting Xin LI <delphij at delphij.net>:
> I have just committed it as openldap-server-2.4.10_1. We may want to
> revise the way we handle DATABASEDIR, which we used to create
> automatically upon installation. Using values from configuration file
> would be definitely better, thanks for your submission!
Thanks a lot for that!
I revised a few things in regard with the DATABASEDIR which led to
some modifications. It goes like this:
1.- When installing from ports, the DATABASEDIR will be always created
no matter what the pkg-plist says. However, when installing a packaged
version, then it is possible to control the creation of the directory.
Patch for "patch-servers::slapd::Makefile.in" disables the automatic
installation of the DATABASEDIR and makes installation from ports and
package consistent with one another.
2.- Since automatic creation of the DATABASEDIR has been disabled,
then the slapd script uses the value of directory from slapd.conf,
creates the folder, populates it (puts DB_CONFIG) and starts slap
daemon.
Patch for "slapd.sh.in" automatically handles the DATABASEDIR from the
"directory" entry located in slapd.conf. Also it quenches the
following error by placing DB_CONFIG:
bdb_db_open: warning - no DB_CONFIG file found in directory
/var/db/openldap-data: (2). Expect poor performance for suffix
"dc=my-domain,dc=com".
3.- When un-installing, a message is shown about deleting the database
permanently and an example of the "rm" command is displayed.
Patch for "pkg-deinstall.in" detects if alternative or default
DATABASEDIR is active, formats and displays the message accordingly.
4.- After above modifications, there's no need of creating and
removing automatically the DATABASEDIR.
Patch for "pkg-plist" disables the creation and deletion of the DATABASEDIR.
Patches:
--- patch-servers::slapd::Makefile.in.orig 2005-09-15 11:47:23.000000000 +0000
+++ patch-servers::slapd::Makefile.in 2008-07-10 15:57:34.000000000 +0000
@@ -1,6 +1,6 @@
---- servers/slapd/Makefile.in.orig Fri Sep 2 00:28:10 2005
-+++ servers/slapd/Makefile.in Sun Sep 4 17:34:37 2005
-@@ -372,7 +372,6 @@
+--- servers/slapd/Makefile.in.orig 2008-02-11 23:26:43.000000000 +0000
++++ servers/slapd/Makefile.in 2008-07-10 12:47:36.000000000 +0000
+@@ -374,7 +374,6 @@
install-slapd: FORCE
-$(MKDIR) $(DESTDIR)$(libexecdir)
@@ -8,7 +8,7 @@
$(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 \
slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
@for i in $(SUBDIRS); do \
-@@ -403,16 +402,18 @@
+@@ -405,16 +404,18 @@
touch all-cffiles
install-schema: FORCE
@@ -21,22 +21,23 @@
@SD=$(DESTDIR)$(schemadir) ; \
- files=`cd $(srcdir)/schema ; echo README *.ldif *.schema` ; \
+ files=`cd $(srcdir)/schema ; echo README *.ldif` ; \
-+ for i in $$files ; do \
-+ echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
-+ $(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
-+ done ; \
-+ files=`cd $(srcdir)/schema ; echo *.schema` ; \
for i in $$files ; do \
echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
$(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
++ done ; \
++ files=`cd $(srcdir)/schema ; echo *.schema` ; \
++ for i in $$files ; do \
++ echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
++ $(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
+ $(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i
$$SD/$$i.default ; \
done
install-conf: FORCE
-@@ -429,8 +430,6 @@
+@@ -430,9 +431,6 @@
+
install-db-config: FORCE
@-$(MKDIR) $(DESTDIR)$(localstatedir) $(DESTDIR)$(sysconfdir)
- @-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data
+- @-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data
- $(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
- $(DESTDIR)$(localstatedir)/openldap-data/DB_CONFIG.example
$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
--- slapd.sh.in.orig 2008-07-07 20:54:21.000000000 +0000
+++ slapd.sh.in 2008-07-10 15:57:51.000000000 +0000
@@ -49,6 +49,10 @@
""|[Nn][Oo][Nn][Ee]|[Dd][Ee][Ff][Aa][Uu][Ll][Tt])
;;
*)
+ if [ ! -d "${DBDIR}" ]; then
+ mkdir -p "${DBDIR}"
+ cp "%%PREFIX%%/etc/openldap/DB_CONFIG.example" "${DBDIR}/DB_CONFIG"
+ fi
chown "$slapd_owner" "%%LDAP_RUN_DIR%%"
chown -RL "$slapd_owner" "${DBDIR}"
chmod 700 "${DBDIR}"
--- pkg-deinstall.in.orig 2007-09-05 06:37:13.000000000 +0000
+++ pkg-deinstall.in 2008-07-10 16:54:29.000000000 +0000
@@ -5,6 +5,10 @@
ECHO_CMD=echo
+if [ -f "%%PREFIX%%/etc/openldap/slapd.conf" ]; then
+ DBDIR=`awk '$1 == "directory" {print $2}'
"%%PREFIX%%/etc/openldap/slapd.conf"`
+fi
+
case $2 in
POST-DEINSTALL)
${ECHO_CMD}
@@ -13,9 +17,13 @@
${ECHO_CMD} "it any longer, you may want to issue the"
${ECHO_CMD} "following commands:"
${ECHO_CMD}
- if [ -d %%DATABASEDIR%% ]; then
+ if ([ "${DBDIR}" ] && [ -d "${DBDIR}" ]) || ([ ! "${DBDIR}" ] && [
-d %%DATABASEDIR%% ]); then
${ECHO_CMD} "- to delete the OpenLDAP database permanently
(losing all data):"
- ${ECHO_CMD} " rm -Rf %%DATABASEDIR%%"
+ if [ "${DBDIR}" ] && [ -d "${DBDIR}" ]; then
+ ${ECHO_CMD} " rm -Rf ${DBDIR}"
+ else
+ ${ECHO_CMD} " rm -Rf %%DATABASEDIR%%"
+ fi
${ECHO_CMD}
fi
${ECHO_CMD} "- to remove the OpenLDAP user:"
--- pkg-plist.orig 2008-06-18 18:59:44.000000000 +0000
+++ pkg-plist 2008-07-10 15:57:17.000000000 +0000
@@ -81,6 +81,4 @@
@cwd /
@exec mkdir -p %%LDAP_RUN_DIR%%
@dirrmtry %%LDAP_RUN_DIR%%
- at exec mkdir -p %%DATABASEDIR%%
- at dirrmtry %%DATABASEDIR%%
@cwd %%PREFIX%%
Regards,
Mikhail.
--
Mikhail Goriachev
Webanoide
More information about the freebsd-ports
mailing list