]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- add openldap_schema_register/openldap_schema_unregister
authorElan Ruusamäe <glen@pld-linux.org>
Fri, 2 Jun 2006 21:00:22 +0000 (21:00 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm.macros -> 1.304

rpm.macros

index 59c93a9367ce45da011d20167029be06d233b8b4..fd1d0e06201b87e5ac5b383b031c59a89fc7bcac 100644 (file)
@@ -927,4 +927,50 @@ if [ -f _noautoreq ]; then \
 fi \
 %{nil}
 
-# vim:ts=8 sw=8 noet
+
+# Register OpenLDAP schema.
+# Author: Elan Ruusamäe <glen@pld-linux.org>
+#
+# 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 <glen@pld-linux.org>
+#
+# 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
This page took 0.052046 seconds and 4 git commands to generate.