1 # Register OpenLDAP schema.
2 # Author: Elan Ruusamäe <glen@pld-linux.org>
5 # %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
7 # -d specify dependant schemas, separated by comma
9 %openldap_schema_register(d:) \
10 for schema in %*; do \
11 if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
13 /^include.*local.schema/{ \
16 " /etc/openldap/slapd.conf \
19 # enable dependant schemas \
20 if [ "%{-d*}" ]; then \
22 /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 's/,/\\\\|/g')\\)\\.schema/{ \
24 }' /etc/openldap/slapd.conf \
28 # Unregister OpenLDAP schema.
29 # Author: Elan Ruusamäe <glen@pld-linux.org>
32 # %%openldap_schema_unregister %{schemadir}/horde.schema
34 %openldap_schema_unregister() \
35 for schema in %*; do \
36 if grep -q "$schema" /etc/openldap/slapd.conf; then \
38 /^include.*$(echo "$schema" | %{__sed} -e 's,/,\\\\/,g')/d \
39 # for symmetry it would be nice if we disable enabled schemas in post, \
40 # but we really can not do that, it would break something else. \
41 " /etc/openldap/slapd.conf \