| sleep 60 # to avoid hitting it while the first start for setting root pwd | sleep 60 # to avoid hitting it while the first start for setting root pwd | ||||
| R=111 | R=111 | ||||
| while [ $R -eq 111 ]; do | while [ $R -eq 111 ]; do | ||||
| mysql --skip-ssl -u root -p${MARIADB_ROOT_PASSWORD} -h ${DB_HOST} -e "SHOW DATABASES" 2> /dev/null; | |||||
| mysql --skip-ssl -u root -p${MARIADB_ROOT_PASSWORD} -h ${DB_HOST} -e "SHOW DATABASES" 1>/dev/null 2>&1; | |||||
| R=$?; | R=$?; | ||||
| done | done | ||||
| cd /var/www/nextcloud | cd /var/www/nextcloud | ||||
| # https://github.com/nextcloud/server/pull/18130#issuecomment-604518403 | # https://github.com/nextcloud/server/pull/18130#issuecomment-604518403 | ||||
| sudo -u www-data rm -Rf /srv/nextcloud/data/admin | sudo -u www-data rm -Rf /srv/nextcloud/data/admin | ||||
| sudo -u www-data php occ maintenance:install --database "mysql" --database-host ${DB_HOST} --database-name ${NEXTCLOUD_DB_NAME} --database-user ${NEXTCLOUD_DB_USER} --database-pass ${NEXTCLOUD_DB_PWD} --admin-user "admin" --admin-pass ${NEXTCLOUD_ADMIN_PWD} --data-dir ${NEXTCLOUD_DATA_PATH} | echo "maintenance:install gone!" | |||||
| sudo -u www-data php occ maintenance:install --database "mysql" --database-host ${DB_HOST} --database-name ${NEXTCLOUD_DB_NAME} --database-user ${NEXTCLOUD_DB_USER} --database-pass ${NEXTCLOUD_DB_PWD} --admin-user "admin" --admin-pass ${NEXTCLOUD_ADMIN_PWD} --data-dir ${NEXTCLOUD_DATA_PATH} | |||||
| check_result $? "Initializing Config" | check_result $? "Initializing Config" | ||||
| # Password salt and secret are used by Passman and must remain the same after | # Password salt and secret are used by Passman and must remain the same after | ||||
| # restarting of the instance, otherwise vaults would become inaccessible | # restarting of the instance, otherwise vaults would become inaccessible |