Change openldap/Makefile.

This commit is contained in:
sfigato 2019-04-12 16:22:36 +02:00
parent d274c1a2ac
commit 9413293578
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -1,3 +1,5 @@
CONTAINER := phi_slapd
.PHONY: all
all: build run
@ -17,22 +19,34 @@ clean:
rm -f key.pem cert.pem
.PHONY: run
run:
docker run -p 389:389 --rm unit/slapd
run: prepare
docker attach phi_slapd
.PHONY: shell
shell:
LDAPTLS_REQCERT=never sh
.PHONY: populate
populate:
ldapmodify -ZZ -H ldap://127.0.0.1 \
.PHONY: prepare
prepare:
docker run -p 389:389 -d --name="$(CONTAINER)" --rm unit/slapd
sleep 2
LDAPTLS_REQCERT=never \
ldapmodify -ZZ -H ldap://127.0.0.1:389 \
-x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \
-a -f init.ldif
.PHONY: run-bg
run-bg:
make prepare
.PHONY: stop
stop: is-running
docker stop $(CONTAINER)
.PHONY: is-running
is-running:
@[[ $$(docker ps -qf=name=$(CONTAINER)|wc -l) -eq 1 ]]
.PHONY: inspect
inspect:
ldapsearch -ZZ -H ldap://127.0.0.1 \
inspect: is-running
LDAPTLS_REQCERT=never \
ldapsearch -ZZ -H ldap://127.0.0.1 \
-x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \
-b "dc=unit,dc=macaomilano,dc=org" \
'(objectclass=*)'