aboutsummaryrefslogtreecommitdiffstats
path: root/ldap/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'ldap/Makefile')
-rw-r--r--ldap/Makefile18
1 files changed, 14 insertions, 4 deletions
diff --git a/ldap/Makefile b/ldap/Makefile
index 8d6868f..01f20fd 100644
--- a/ldap/Makefile
+++ b/ldap/Makefile
@@ -4,6 +4,7 @@ TMPSLAPD := /tmp/$(shell mktemp -u slapd.d-XXXXXX)
BACKUPDB := /tmp/$(shell mktemp -u db-XXXXXX.ldif)
BACKUPCONFIG := /tmp/$(shell mktemp -u config-XXXXXX.ldif)
NUM := $(shell ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b "cn=config" "olcSuffix=$(SUFFIX)" dn | sed -e '/^$$/d' -e 's/^dn: //')
+NUM2 := $(shell echo "$(NUM)" | sed -re 's/(.*),(cn=config)$$/\2\/\1/')
SCHEMA := $(shell grep -i '^dn: ' fripost.ldif | sed -re 's/^dn: cn=([^,]+),.*/\1/')
all:
@@ -29,6 +30,13 @@ install-mx:
@rmdir "$(BACKUPSLAPD)"
+install:
+ # ldapadd -Y EXTERNAL -H ldapi:/// -f fripost.ldif
+ # ldapadd -Y EXTERNAL -H ldapi:/// -f index.ldif
+ # ldapadd -Y EXTERNAL -H ldapi:/// -f constraint.ldif
+ # ldapadd -Y EXTERNAL -H ldapi:/// -f acl.ldif
+ # ldapadd -Y EXTERNAL -H ldapi:/// -f base.ldif
+ # ldapadd -Y EXTERNAL -H ldapi:/// -f populate.ldif
install-schema:
@ldapadd -Q -Y EXTERNAL -H ldapi:/// -f fripost.ldif
@@ -40,7 +48,7 @@ install-acl:
uninstall:
@echo "The database - suffix \"$(SUFFIX)\" - will be saved into \`$(BACKUPDB)' (if non-empty), and then *cleared* (but not deleted)."
- @echo "Also, its ACLs and indexes will be cleared as well, if there are any."
+ @echo "Also, its ACLs, indexes and constraints will be cleared as well, if there are any."
@echo "Global configuration will be saved into \`$(BACKUPCONFIG)'."
@echo "slapd will be offline for a moment - at best."
@/bin/echo -n "Are you sure you want to continue [y/N] "
@@ -65,11 +73,13 @@ uninstall:
;else \
echo "No indexes to remove" \
;fi
-
+#
@echo "Making a new configuration directory at \`$(TMPSLAPD)'"
@mkdir -m0700 "$(TMPSLAPD)" && slapcat -n0 | slapadd -F "$(TMPSLAPD)" -n0 && chown -R 'openldap:openldap' "$(TMPSLAPD)"
-
- @echo "Deleting schema \"cn=$(SCHEMA),cn=config\"" && find "$(TMPSLAPD)" -name "cn={*}$(SCHEMA).ldif" -delete
+#
+ @echo "Deleting schema \"cn=$(SCHEMA),cn=config\"" && find "$(TMPSLAPD)/cn=config/cn=schema/" -type f -name "cn={*}$(SCHEMA).ldif" -delete
+#
+ @echo "Deleting constraints" && find "$(TMPSLAPD)/$(NUM2)/" -type f -name "olcOverlay={*}constraint.ldif" -delete
#
@/etc/init.d/slapd stop
#