]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame - macros.openldap
- add rpmrc for rpm.org and add rename TODO
[packages/rpm-build-macros.git] / macros.openldap
CommitLineData
cdc9189e
JR
1# Register OpenLDAP schema.
2# Author: Elan Ruusamäe <glen@pld-linux.org>
3#
4# Usage:
5# %%openldap_schema_register [-d core,nis] %{schemadir}/horde.schema
6#
7# -d specify dependant schemas, separated by comma
8#
9%openldap_schema_register(d:) \
10for schema in %*; do \
11 if ! grep -q "$schema" /etc/openldap/slapd.conf; then \
12 %{__sed} -i -e " \
13 /^include.*local.schema/{ \
14 iinclude\\t $schema\
15 } \
16 " /etc/openldap/slapd.conf \
17 fi \
18done \
19# enable dependant schemas \
20if [ "%{-d*}" ]; then \
21 %{__sed} -i -e ' \
22 /^#include.*\\(%(echo '%{-d*}' | %{__sed} -e 's/,/\\\\|/g')\\)\\.schema/{ \
23 s/^#// \
24 }' /etc/openldap/slapd.conf \
25fi \
26%{nil}
27
28# Unregister OpenLDAP schema.
29# Author: Elan Ruusamäe <glen@pld-linux.org>
30#
31# Usage:
32# %%openldap_schema_unregister %{schemadir}/horde.schema
33#
34%openldap_schema_unregister() \
35for schema in %*; do \
36 if grep -q "$schema" /etc/openldap/slapd.conf; then \
37 %{__sed} -i -e " \
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 \
42 fi \
43done \
44%{nil}
This page took 0.03624 seconds and 4 git commands to generate.