#!/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 PGPASSWORD=$DBPASSWORD psql -h $DBHOST -U $DBUSER -d $DBNAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '${DBTABLEPREFIX}appconfig')" | grep f if [ $? -ne 1 ]; then cd /var/lib/nextcloud s6-setuidgid nginx ./occ maintenance:install \ --database=pgsql \ --database-host=$DBHOST \ --database-name=$DBNAME \ --database-user=$DBUSER \ --database-pass=$DBPASSWORD \ --database-table-prefix=$DBTABLEPREFIX \ --admin-user=$ADMINUSER \ --admin-pass=$ADMINPASSWORD \ --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 s6-setuidgid nginx ./occ ldap:set-config '' hasMemberOfFilterSupport "1" s6-setuidgid nginx ./occ ldap:set-config '' ldapHost "$LDAPHOST" s6-setuidgid nginx ./occ ldap:set-config '' ldapPort "$LDAPPORT" s6-setuidgid nginx ./occ ldap:set-config '' ldapTLS "$LDAPTLS" s6-setuidgid nginx ./occ ldap:set-config '' ldapAgentName "$LDAPBINDUSER" s6-setuidgid nginx ./occ ldap:set-config '' ldapAgentPassword "$LDAPBINDPASSWORD" s6-setuidgid nginx ./occ ldap:set-config '' ldapLoginFilter "$LDAPLOGINFILTER" s6-setuidgid nginx ./occ ldap:set-config '' ldapUserDisplayName "$LDAPUSERDISPLAYNAME" s6-setuidgid nginx ./occ ldap:set-config '' ldapUserFilter "$LDAPUSERFILTER" s6-setuidgid nginx ./occ ldap:set-config '' ldapBase "$LDAPBASEDN" s6-setuidgid nginx ./occ ldap:set-config '' ldapBaseUsers "$LDAPBASEUSERDN" s6-setuidgid nginx ./occ ldap:set-config '' ldapEmailAttribute "$LDAPEMAILATTRIBUTE" s6-setuidgid nginx ./occ ldap:set-config '' ldapBaseGroups "$LDAPBASEGROUPDN" s6-setuidgid nginx ./occ ldap:set-config '' ldapGroupFilter "$LDAPGROUPFILTER" s6-setuidgid nginx ./occ ldap:set-config '' ldapExpertUsernameAttr "$LDAPUSERNAMEATTRIBUTE" s6-setuidgid nginx ./occ ldap:set-config '' turnOffCertCheck "$LDAPTURNOFFCERTCHECK" s6-setuidgid nginx ./occ ldap:set-config '' ldapConfigurationActive "1" fi