diff --git a/Makefile b/Makefile index 6d97ee9..5c88094 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -NAME = osixia/openldap -VERSION = 1.5.0 +NAME ?= osixia/openldap +VERSION ?= 1.5.1 .PHONY: build build-nocache test tag-latest push push-latest release git-tag-version diff --git a/image/service/slapd/startup.sh b/image/service/slapd/startup.sh index d66a6a6..b1cc728 100755 --- a/image/service/slapd/startup.sh +++ b/image/service/slapd/startup.sh @@ -465,14 +465,18 @@ EOF log-helper info "Add replication config..." disableReplication || true - i=1 + i=0 + LDAP_SERVER_ID_FROM=${LDAP_SERVER_ID_FROM:-1} + LDAP_CONFIG_REPL_ID_FROM=${LDAP_CONFIG_REPL_ID_FROM:-1} + LDAP_DB_REPL_ID_FROM=${LDAP_DB_REPL_ID_FROM:-101} + log-helper debug "$LDAP_REPLICATION_HOSTS" for host in $(complex-bash-env iterate LDAP_REPLICATION_HOSTS) do - sed -i "s|{{ LDAP_REPLICATION_HOSTS }}|olcServerID: $i ${!host}\n{{ LDAP_REPLICATION_HOSTS }}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/replication/replication-enable.ldif - sed -i "s|{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|olcSyncRepl: rid=00$i provider=${!host} ${LDAP_REPLICATION_CONFIG_SYNCPROV}\n{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/replication/replication-enable.ldif - sed -i "s|{{ LDAP_REPLICATION_HOSTS_DB_SYNC_REPL }}|olcSyncRepl: rid=10$i provider=${!host} ${LDAP_REPLICATION_DB_SYNCPROV}\n{{ LDAP_REPLICATION_HOSTS_DB_SYNC_REPL }}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/replication/replication-enable.ldif + sed -i "s|{{ LDAP_REPLICATION_HOSTS }}|olcServerID: $((LDAP_SERVER_ID_FROM+i)) ${!host}\n{{ LDAP_REPLICATION_HOSTS }}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/replication/replication-enable.ldif + sed -i "s|{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|olcSyncRepl: rid=$(printf %03d $((LDAP_CONFIG_REPL_ID_FROM+i))) provider=${!host} ${LDAP_REPLICATION_CONFIG_SYNCPROV}\n{{ LDAP_REPLICATION_HOSTS_CONFIG_SYNC_REPL }}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/replication/replication-enable.ldif + sed -i "s|{{ LDAP_REPLICATION_HOSTS_DB_SYNC_REPL }}|olcSyncRepl: rid=$(printf %03d $((LDAP_DB_REPL_ID_FROM+i))) provider=${!host} ${LDAP_REPLICATION_DB_SYNCPROV}\n{{ LDAP_REPLICATION_HOSTS_DB_SYNC_REPL }}|g" ${CONTAINER_SERVICE_DIR}/slapd/assets/config/replication/replication-enable.ldif - ((i++)) + ((++i)) done get_ldap_base_dn