2016-08-31 12:55:12 +00:00
|
|
|
#!/usr/bin/with-contenv sh
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
chmod +x /var/lib/nextcloud/occ # for some reason it doesn't work when done from the Dockerfile
|
|
|
|
|
|
|
|
if [ ! -f /var/lib/nextcloud/data/.ocdata ]; then
|
|
|
|
touch /var/lib/nextcloud/data/.ocdata
|
|
|
|
fi
|
|
|
|
|
2016-11-01 13:52:07 +00:00
|
|
|
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '${DB_TABLE_PREFIX}appconfig')" | grep f
|
2016-08-31 12:55:12 +00:00
|
|
|
|
|
|
|
if [ $? -ne 1 ]; then
|
|
|
|
cd /var/lib/nextcloud
|
2017-06-15 09:46:12 +00:00
|
|
|
|
2017-06-15 10:04:06 +00:00
|
|
|
if [ -f /var/lib/nextcloud/config/config.php ]; then
|
2017-06-15 09:56:37 +00:00
|
|
|
sed -i -e "s/'installed' => true,/'installed' => false,/g" /var/lib/nextcloud/config/config.php
|
|
|
|
fi
|
2017-06-15 10:04:25 +00:00
|
|
|
|
2016-08-31 12:55:12 +00:00
|
|
|
s6-setuidgid nginx ./occ maintenance:install \
|
|
|
|
--database=pgsql \
|
2016-11-01 13:52:07 +00:00
|
|
|
--database-host=$DB_HOST \
|
|
|
|
--database-name=$DB_NAME \
|
|
|
|
--database-user=$DB_USER \
|
|
|
|
--database-pass=$DB_PASSWORD \
|
|
|
|
--database-table-prefix=$DB_TABLE_PREFIX \
|
|
|
|
--admin-user=$ADMIN_USER \
|
|
|
|
--admin-pass=$ADMIN_PASSWORD \
|
2016-08-31 12:55:12 +00:00
|
|
|
--no-interaction
|
|
|
|
|
|
|
|
s6-setuidgid nginx ./occ config:app:set --value cron core backgroundjobs_mode
|
|
|
|
s6-setuidgid nginx ./occ app:enable user_ldap
|
|
|
|
|
|
|
|
s6-setuidgid nginx ./occ ldap:create-empty-config
|
|
|
|
|
2017-06-15 09:46:12 +00:00
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' hasMemberOfFilterSupport "1"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapExperiencedAdmin "1"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapIgnoreNamingRules "1"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapHost "$LDAP_HOST"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapPort "$LDAP_PORT"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapTLS "$LDAP_TLS"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapAgentName "$LDAP_BIND_USER"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapAgentPassword "$LDAP_BIND_PASSWORD"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapLoginFilter "$LDAP_LOGIN_FILTER"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapUserDisplayName "$LDAP_USER_DISPLAY_NAME"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapUserFilter "$LDAP_USER_FILTER"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapBase "$LDAP_BASE_DN"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapBaseUsers "$LDAP_BASE_USER_DN"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapEmailAttribute "$LDAP_EMAIL_ATTRIBUTE"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapBaseGroups "$LDAP_BASE_GROUP_DN"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapGroupFilter "$LDAP_GROUP_FILTER"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapExpertUsernameAttr "$LDAP_USERNAME_ATTRIBUTE"
|
2017-06-15 10:34:36 +00:00
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldap_expert_uuid_group_attr "$LDAP_USERNAME_ATTRIBUTE"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldap_expert_uuid_user_attr "$LDAP_USERNAME_ATTRIBUTE"
|
2017-06-15 09:46:12 +00:00
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' turnOffCertCheck "$LDAP_TURN_OFF_CERT_CHECK"
|
|
|
|
s6-setuidgid nginx ./occ ldap:set-config 's01' ldapConfigurationActive "1"
|
2016-08-31 12:55:12 +00:00
|
|
|
fi
|