Author: glen                         Date: Fri Jun  2 21:00:27 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add openldap_schema_register/openldap_schema_unregister

---- Files affected:
SOURCES:
   rpm.macros (1.303 -> 1.304) 

---- Diffs:

================================================================
Index: SOURCES/rpm.macros
diff -u SOURCES/rpm.macros:1.303 SOURCES/rpm.macros:1.304
--- SOURCES/rpm.macros:1.303    Thu May 25 09:26:25 2006
+++ SOURCES/rpm.macros  Fri Jun  2 23:00:22 2006
@@ -927,4 +927,50 @@
 fi \
 %{nil}
 
-# vim:ts=8 sw=8 noet
+
+# Register OpenLDAP schema.
+# Author: Elan Ruusamäe <[EMAIL PROTECTED]>
+#
+# Usage:
+#   %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
+#
+#  -d specify dependant schemas, separated by comma
+#
+%openldap_schema_register(d:) \
+for schema in %*; do \
+       if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
+               %{__sed} -i -e " \
+                       /^include.*local.schema/{ \
+                               iinclude\\t     $schema\
+                       } \
+               " /etc/openldap/slapd.conf \
+       fi \
+done \
+# enable dependant schemas \
+if [ "%{-d*}" ]; then \
+       %{__sed} -i -e ' \
+       /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 
's/,/\\\\|/g')\\)\\.schema/{ \
+               s/^#// \
+       }' /etc/openldap/slapd.conf \
+fi \
+%{nil}
+
+# Unregister OpenLDAP schema.
+# Author: Elan Ruusamäe <[EMAIL PROTECTED]>
+#
+# Usage:
+#   %%openldap_schema_unregister %{schemadir}/horde.schema
+#
+%openldap_schema_unregister() \
+for schema in %*; do \
+       if grep -q "$schema" /etc/openldap/slapd.conf; then \
+               %{__sed} -i -e " \
+               /^include.*$(echo "$schema" | %{__sed} -e 's,/,\\\\/,g')/d \
+               # for symmetry it would be nice if we disable enabled schemas 
in post, \
+               # but we really can not do that, it would break something else. 
\
+               " /etc/openldap/slapd.conf \
+       fi \
+done \
+%{nil}
+
+# vim:ts=4 sw=4 noet
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/rpm.macros?r1=1.303&r2=1.304&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to