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 .PHONY: all
all: build run all: build run
@ -17,22 +19,34 @@ clean:
rm -f key.pem cert.pem rm -f key.pem cert.pem
.PHONY: run .PHONY: run
run: run: prepare
docker run -p 389:389 --rm unit/slapd docker attach phi_slapd
.PHONY: shell .PHONY: prepare
shell: prepare:
LDAPTLS_REQCERT=never sh docker run -p 389:389 -d --name="$(CONTAINER)" --rm unit/slapd
sleep 2
.PHONY: populate LDAPTLS_REQCERT=never \
populate: ldapmodify -ZZ -H ldap://127.0.0.1:389 \
ldapmodify -ZZ -H ldap://127.0.0.1 \
-x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \ -x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \
-a -f init.ldif -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 .PHONY: inspect
inspect: inspect: is-running
ldapsearch -ZZ -H ldap://127.0.0.1 \ LDAPTLS_REQCERT=never \
ldapsearch -ZZ -H ldap://127.0.0.1 \
-x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \ -x -D "cn=root,dc=unit,dc=macaomilano,dc=org" -w root \
-b "dc=unit,dc=macaomilano,dc=org" \ -b "dc=unit,dc=macaomilano,dc=org" \
'(objectclass=*)' '(objectclass=*)'