diff --git a/slapd.sh b/slapd.sh index b8febef..4571530 100755 --- a/slapd.sh +++ b/slapd.sh @@ -6,15 +6,15 @@ status () { echo "---> ${@}" >&2 } -set -x -: LDAP_ADMIN_PWD=${LDAP_ADMIN_PWD} -: LDAP_DOMAIN=${LDAP_DOMAIN} -: LDAP_ORGANISATION=${LDAP_ORGANISATION} - - if [ ! -e /var/lib/ldap/docker_bootstrapped ]; then status "configuring slapd for first run" + set -x + : LDAP_ADMIN_PWD=${LDAP_ADMIN_PWD} + : LDAP_DOMAIN=${LDAP_DOMAIN} + : LDAP_ORGANISATION=${LDAP_ORGANISATION} + + # permission error on /etc/ldap/slapd.conf if not set?! :'( adduser openldap root @@ -37,7 +37,6 @@ EOF dpkg-reconfigure -f noninteractive slapd - ############ Custom config ############ slapd -h "ldap:/// ldapi:///" -u openldap -g openldap chown -R openldap:openldap /etc/ldap @@ -60,7 +59,7 @@ EOF fi # Replication - # todo + # todo :) # Other config files for f in $(find /etc/ldap/config -maxdepth 1 -name \*.ldif -type f); do @@ -70,6 +69,8 @@ EOF kill -INT `cat /run/slapd/slapd.pid` + unset LDAP_ADMIN_PWD + touch /var/lib/ldap/docker_bootstrapped else diff --git a/test/build.sh b/test/build.sh index f7b7944..b0c77cb 100755 --- a/test/build.sh +++ b/test/build.sh @@ -1,4 +1,4 @@ #!/bin/sh -sudo docker.io build -t openldap-test . -#sudo docker.io build --no-cache=true -t openldap-test . +#sudo docker.io build -t openldap-test . +sudo docker.io build --no-cache=true -t openldap-test . diff --git a/test/delete-container.sh b/test/delete-container.sh deleted file mode 100644 index 6b890d8..0000000 --- a/test/delete-container.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# remove openldap test containers -sudo docker.io ps -a > testcontainers.out - -if [ "$(grep -c "openldap-test-container" ./testcontainers.out)" -ne 0 ]; then - sudo docker.io stop openldap-test-container - sudo docker.io rm openldap-test-container -fi - -rm testcontainers.out diff --git a/test/end.sh b/test/end.sh deleted file mode 100644 index f98fa92..0000000 --- a/test/end.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./test/delete-container.sh diff --git a/test/prepare.sh b/test/prepare.sh deleted file mode 100644 index f98fa92..0000000 --- a/test/prepare.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -./test/delete-container.sh diff --git a/test/tools/delete-container.sh b/test/tools/delete-container.sh index 6d5e28f..01fa717 100755 --- a/test/tools/delete-container.sh +++ b/test/tools/delete-container.sh @@ -1,11 +1,11 @@ #!/bin/sh # remove openldap test container -sudo docker.io ps -a > testcontainer.out +docker.io ps -a > testcontainer.out if [ "$(grep -c "openldap-test-container" ./testcontainer.out)" -ne 0 ]; then - sudo docker.io stop openldap-test-container - sudo docker.io rm openldap-test-container + docker.io stop openldap-test-container + docker.io rm openldap-test-container fi rm testcontainer.out diff --git a/test/tools/delete-image.sh b/test/tools/delete-image.sh new file mode 100755 index 0000000..48ebc99 --- /dev/null +++ b/test/tools/delete-image.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# remove openldap test image +docker.io images > testimage.out + +if [ "$(grep -c "openldap-test" ./testimage.out)" -ne 0 ]; then + docker.io rmi openldap-test +fi + +rm testimage.out diff --git a/test/tools/end.sh b/test/tools/end.sh index 75fec9d..779dd5a 100755 --- a/test/tools/end.sh +++ b/test/tools/end.sh @@ -1,3 +1,4 @@ #!/bin/sh ./test/tools/delete-container.sh +./test/tools/delete-image.sh