From afb920c147ae8d2988d6b2b38ed1ccf5e3a3e808 Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Mon, 29 Jul 2019 13:50:00 +0200 Subject: [PATCH] Prevent failure due to -e flag used Call get_ldap_base_dn to detect failure very early --- image/service/slapd/startup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/image/service/slapd/startup.sh b/image/service/slapd/startup.sh index c6d9d9bb..0a56f0e3 100755 --- a/image/service/slapd/startup.sh +++ b/image/service/slapd/startup.sh @@ -53,11 +53,13 @@ if [ ! -e "$FIRST_START_DONE" ]; then fi # Check that LDAP_BASE_DN and LDAP_DOMAIN are in sync domain_from_base_dn=$(echo $LDAP_BASE_DN | tr ',' '\n' | sed -e 's/^.*=//' | tr '\n' '.' | sed -e 's/\.$//') + set +e echo "$domain_from_base_dn" | egrep -q ".*$LDAP_DOMAIN\$" if [ $? -ne 0 ]; then log-helper error "Error: domain $domain_from_base_dn derived from LDAP_BASE_DN $LDAP_BASE_DN does not match LDAP_DOMAIN $LDAP_DOMAIN" exit 1 fi + set -e } function is_new_schema() { @@ -102,6 +104,7 @@ if [ ! -e "$FIRST_START_DONE" ]; then log-helper info "Database and config directory are empty..." log-helper info "Init new ldap server..." + get_ldap_base_dn cat <