2017-05-05 11:19:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2017-05-08 05:56:55 +00:00
|
|
|
mkdir -p /app/data/config
|
2017-05-05 11:19:38 +00:00
|
|
|
|
2017-06-10 09:38:41 +00:00
|
|
|
export STNODEFAULTFOLDER=1 STNOUPGRADE=1
|
|
|
|
|
2017-05-26 02:19:46 +00:00
|
|
|
# if this if the first run, generate a useful config
|
|
|
|
if [ ! -f /app/data/config/config.xml ]; then
|
|
|
|
echo "=> Generating config"
|
|
|
|
/app/code/syncthing --generate="/app/data/config"
|
2017-05-05 11:19:38 +00:00
|
|
|
fi
|
|
|
|
|
2017-05-08 05:56:55 +00:00
|
|
|
cat >/run/ldap.conf <<EOF
|
|
|
|
ldap_server cloudron {
|
|
|
|
url ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username;
|
|
|
|
binddn ${LDAP_BIND_DN};
|
|
|
|
binddn_passwd ${LDAP_BIND_PASSWORD};
|
|
|
|
group_attribute ${LDAP_GROUPS_BASE_DN};
|
|
|
|
group_attribute_is_dn on;
|
|
|
|
require valid_user;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2017-06-07 22:26:33 +00:00
|
|
|
# Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
|
|
|
|
sed -e 's,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:22000</listenAddress>,' -i /app/data/config/config.xml
|
|
|
|
sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
|
|
|
|
|
2017-06-10 09:25:07 +00:00
|
|
|
chown -R cloudron:cloudron /app/data/config /app/data
|
|
|
|
|
2017-05-05 11:19:38 +00:00
|
|
|
exec busybox init
|
|
|
|
|