-
Notifications
You must be signed in to change notification settings - Fork 0
/
apacheds-entrypoint.sh
26 lines (25 loc) · 1.12 KB
/
apacheds-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
set -e
if [ "$1" = "/apacheds-start.sh" ]; then
if [ ! -e "${APACHEDS_INSTANCE_PATH}" ]; then
echo "The ${APACHEDS_INSTANCE} instance doesn't exist. Creating instance ..."
cp -rp "${APACHEDS_TEMPLATE}/default" "${APACHEDS_INSTANCE_PATH}"
# Add customise ldif files
if [ -e "${APACHEDS_INSTANCE_PATH}/conf/config.ldif" ]; then
for f in /docker-entrypoint-init.d/*; do
case "$f" in
*.ldif) echo "$0: importing $f"; echo >> "${APACHEDS_INSTANCE_PATH}/conf/config.ldif" ; cat "$f" >> "${APACHEDS_INSTANCE_PATH}/conf/config.ldif" ;;
*) echo "$0: ignoring $f" ;;
esac
done
# Disable anonymous access
sed -i "s#ads-dsallowanonymousaccess: TRUE#ads-dsallowanonymousaccess: FALSE#g" "${APACHEDS_INSTANCE_PATH}/conf/config.ldif"
# Enable access control
sed -i "s#ads-dsaccesscontrolenabled: FALSE#ads-dsaccesscontrolenabled: TRUE#g" "${APACHEDS_INSTANCE_PATH}/conf/config.ldif"
chown apacheds:apacheds "${APACHEDS_INSTANCE_PATH}/conf/config.ldif"
fi
else
echo "Use exists ${APACHEDS_INSTANCE} instance"
fi
fi
exec "$@"