Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2008 18:22:43 -0400
From:      Mikhail Goriachev <mikhailg@webanoide.org>
To:        d@delphij.net, Xin LI <delphij@delphij.net>, Peter Pentchev <roam@ringlet.net>, delphij@FreeBSD.ORG, ports@FreeBSD.ORG
Subject:   Re: FreeBSD Port: openldap-server-2.4.10
Message-ID:  <20080710182243.17876qn09y73fs84@www.san.navalradio.cl>
In-Reply-To: <487282F9.9020701@delphij.net>
References:  <20080704132215.36754y85s8y8kisk@www.san.navalradio.cl> <20080704221500.GA1118@straylight.m.ringlet.net> <20080704223432.49566vn60rygljk8@www.san.navalradio.cl> <20080705075249.GA1145@straylight.m.ringlet.net> <20080707164339.10063b9lns9zqh2c@www.san.navalradio.cl> <487282F9.9020701@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Xin LI <delphij@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 =20
some modifications. It goes like this:

1.- When installing from ports, the DATABASEDIR will be always created =20
no matter what the pkg-plist says. However, when installing a packaged =20
version, then it is possible to control the creation of the directory.

Patch for "patch-servers::slapd::Makefile.in" disables the automatic =20
installation of the DATABASEDIR and makes installation from ports and =20
package consistent with one another.

2.- Since automatic creation of the DATABASEDIR has been disabled, =20
then the slapd script uses the value of directory from slapd.conf, =20
creates the folder, populates it (puts DB_CONFIG) and starts slap =20
daemon.

Patch for "slapd.sh.in" automatically handles the DATABASEDIR from the =20
"directory" entry located in slapd.conf. Also it quenches the =20
following error by placing DB_CONFIG:

bdb_db_open: warning - no DB_CONFIG file found in directory =20
/var/db/openldap-data: (2). Expect poor performance for suffix =20
"dc=3Dmy-domain,dc=3Dcom".

3.- When un-installing, a message is shown about deleting the database =20
permanently and an example of the "rm" command is displayed.

Patch for "pkg-deinstall.in" detects if alternative or default =20
DATABASEDIR is active, formats and displays the message accordingly.

4.- After above modifications, there's no need of creating and =20
removing automatically the DATABASEDIR.

Patch for "pkg-plist" disables the creation and deletion of the DATABASEDIR.



Patches:



--- patch-servers::slapd::Makefile.in.orig=092005-09-15 11:47:23.000000000 +=
0000
+++ patch-servers::slapd::Makefile.in=092008-07-10 15:57:34.000000000 +0000
@@ -1,6 +1,6 @@
---- servers/slapd/Makefile.in.orig=09Fri Sep  2 00:28:10 2005
-+++ servers/slapd/Makefile.in=09Sun Sep  4 17:34:37 2005
-@@ -372,7 +372,6 @@
+--- servers/slapd/Makefile.in.orig=092008-02-11 23:26:43.000000000 +0000
++++ servers/slapd/Makefile.in=092008-07-10 12:47:36.000000000 +0000
+@@ -374,7 +374,6 @@

   install-slapd: FORCE
   =09-$(MKDIR) $(DESTDIR)$(libexecdir)
@@ -8,7 +8,7 @@
   =09$(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 \
   =09=09slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
   =09@for i in $(SUBDIRS); do \
-@@ -403,16 +402,18 @@
+@@ -405,16 +404,18 @@
   =09touch all-cffiles

   install-schema: FORCE
@@ -21,22 +21,23 @@
   =09@SD=3D$(DESTDIR)$(schemadir) ; \
  -=09files=3D`cd $(srcdir)/schema ; echo README *.ldif *.schema` ; \
  +=09files=3D`cd $(srcdir)/schema ; echo README *.ldif` ; \
-+=09for i in $$files ; do \
-+=09=09echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
-+=09=09$(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
-+=09done ; \
-+=09files=3D`cd $(srcdir)/schema ; echo *.schema` ; \
   =09for i in $$files ; do \
   =09=09echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
   =09=09$(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
++=09done ; \
++=09files=3D`cd $(srcdir)/schema ; echo *.schema` ; \
++=09for i in $$files ; do \
++=09=09echo $(INSTALL) $(INSTALLFLAGS) -m 444 schema/$$i $$SD/$$i ; \
++=09=09$(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i $$SD/$$i ; \
  +=09=09$(INSTALL) $(INSTALLFLAGS) -m 444 $(srcdir)/schema/$$i =20
$$SD/$$i.default ; \
   =09done

   install-conf: FORCE
-@@ -429,8 +430,6 @@
+@@ -430,9 +431,6 @@
+
   install-db-config: FORCE
   =09@-$(MKDIR) $(DESTDIR)$(localstatedir) $(DESTDIR)$(sysconfdir)
- =09@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data
+-=09@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data
  -=09$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
  -=09=09$(DESTDIR)$(localstatedir)/openldap-data/DB_CONFIG.example
   =09$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \







--- slapd.sh.in.orig=092008-07-07 20:54:21.000000000 +0000
+++ slapd.sh.in=092008-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=092007-09-05 06:37:13.000000000 +0000
+++ pkg-deinstall.in=092008-07-10 16:54:29.000000000 +0000
@@ -5,6 +5,10 @@

  ECHO_CMD=3Decho

+if [ -f "%%PREFIX%%/etc/openldap/slapd.conf" ]; then
+  DBDIR=3D`awk '$1 =3D=3D "directory" {print $2}' =20
"%%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}" ] && [ =20
-d %%DATABASEDIR%% ]); then
      ${ECHO_CMD} "- to delete the OpenLDAP database permanently =20
(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=092008-06-18 18:59:44.000000000 +0000
+++ pkg-plist=092008-07-10 15:57:17.000000000 +0000
@@ -81,6 +81,4 @@
  @cwd /
  @exec mkdir -p %%LDAP_RUN_DIR%%
  @dirrmtry %%LDAP_RUN_DIR%%
-@exec mkdir -p %%DATABASEDIR%%
-@dirrmtry %%DATABASEDIR%%
  @cwd %%PREFIX%%








Regards,
Mikhail.


--=20
Mikhail Goriachev
Webanoide




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080710182243.17876qn09y73fs84>