Skip to content

Commit f931ff2

Browse files
committed
Fixed error when create a backend for BASE_DN with OU in Docker
1 parent c4806f2 commit f931ff2

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

  • opendj-packages/opendj-docker/bootstrap

opendj-packages/opendj-docker/bootstrap/setup.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,12 @@ echo "creating backend: $BACKEND_TYPE db-directory: ${BACKEND_DB_DIRECTORY}"
4141
--set enabled:true --no-prompt --trustAll
4242

4343
if [ "$ADD_BASE_ENTRY" = "--addBaseEntry" ]; then
44-
45-
DC=$(echo "$BASE_DN" | awk -F',|=' '{print $2}')
46-
47-
/opt/opendj/bin/ldapmodify --hostname localhost \
48-
--port 1636 --bindDN "$ROOT_USER_DN" --bindPassword "$ROOT_PASSWORD" \
49-
--useSsl --trustAll <<EOF
50-
dn: $BASE_DN
51-
dc: $DC
52-
objectClass: domain
53-
objectClass: top
54-
EOF
55-
44+
echo "creating base entry..."
45+
BASE_TEMPLATE=$(mktemp)
46+
echo "branch: $BASE_DN" > $BASE_TEMPLATE
47+
/opt/opendj/bin/import-ldif --templateFile $BASE_TEMPLATE \
48+
--backendID=userRoot --bindDN "$ROOT_USER_DN" --bindPassword "$ROOT_PASSWORD"
49+
rm $BASE_TEMPLATE
5650
fi
5751

5852

0 commit comments

Comments
 (0)