[openldap] simplify checking for missing server configuration

jsynacek jsynacek at fedoraproject.org
Mon Jan 26 13:33:30 UTC 2015


commit ee4af285838d1bc6e61fc859086cb74321b4e838
Author: Jan Synacek <jsynacek at redhat.com>
Date:   Mon Jan 26 14:05:15 2015 +0100

    simplify checking for missing server configuration

 libexec-convert-config.sh |   79 ---------------------------------------------
 openldap.spec             |   10 +++--
 2 files changed, 6 insertions(+), 83 deletions(-)
---
diff --git a/openldap.spec b/openldap.spec
index 500696d..f12a1b4 100644
--- a/openldap.spec
+++ b/openldap.spec
@@ -16,7 +16,6 @@ Source3: slapd.ldif
 Source4: ldap.conf
 Source10: ltb-project-openldap-ppolicy-check-password-%{check_password_version}.tar.gz
 Source50: libexec-functions
-Source51: libexec-convert-config.sh
 Source52: libexec-check-config.sh
 Source53: libexec-upgrade-db.sh
 Source54: libexec-create-certdb.sh
@@ -272,7 +271,6 @@ install -m 0644 %SOURCE4 %{buildroot}%{_sysconfdir}/openldap/ldap.conf
 mkdir -p %{buildroot}%{_libexecdir}
 install -m 0755 -d %{buildroot}%{_libexecdir}/openldap
 install -m 0644 %SOURCE50 %{buildroot}%{_libexecdir}/openldap/functions
-install -m 0755 %SOURCE51 %{buildroot}%{_libexecdir}/openldap/convert-config.sh
 install -m 0755 %SOURCE52 %{buildroot}%{_libexecdir}/openldap/check-config.sh
 install -m 0755 %SOURCE53 %{buildroot}%{_libexecdir}/openldap/upgrade-db.sh
 install -m 0755 %SOURCE54 %{buildroot}%{_libexecdir}/openldap/create-certdb.sh
@@ -376,7 +374,11 @@ exit 0
 if [[ ! -f %{_sysconfdir}/openldap/slapd.d/cn=config.ldif && \
       ! -f %{_sysconfdir}/openldap/slapd.conf
    ]]; then
-    %{_libexecdir}/openldap/convert-config.sh -f %{_datadir}/openldap-servers/slapd.ldif &>/dev/null
+      # if there is no configuration available, generate one from the defaults
+      mkdir -p %{_sysconfdir}/openldap/slapd.d/ &>/dev/null || :
+      /usr/sbin/slapadd -F %{_sysconfdir}/openldap/slapd.d/ -n0 -l %{_datadir}/openldap-servers/slapd.ldif
+      chown -R ldap:ldap %{_sysconfdir}/openldap/slapd.d/
+      %{systemctl_bin} try-restart slapd.service &>/dev/null
 fi
 
 start_slapd=0
@@ -516,7 +518,6 @@ exit 0
 %{_libdir}/openldap/valsort*
 %{_libdir}/openldap/check_password*
 %{_libexecdir}/openldap/functions
-%{_libexecdir}/openldap/convert-config.sh
 %{_libexecdir}/openldap/check-config.sh
 %{_libexecdir}/openldap/upgrade-db.sh
 %{_libexecdir}/openldap/generate-server-cert.sh
@@ -542,6 +543,7 @@ exit 0
 * Mon Jan 26 2015 Jan Synáček <jsynacek at redhat.com> - 2.4.40-7
 - remove tmpfiles config since it's no longer needed
 - fix invalid ldif
+- simplify checking for missing server configuration
 
 * Fri Jan 16 2015 Jan Synáček <jsynacek at redhat.com> - 2.4.40-6
 - remove openldap-fedora-systemd.patch


More information about the scm-commits mailing list