diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index 8f07515..26522b5 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -138,6 +138,7 @@ if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_ins --database-name="${DB_NAME}" \ --database-user="${DB_USER}" \ --database-pass="${DB_PASS}" \ + --admin-user="${ADMIN_USER:-admin}" \ --admin-pass="${ADMIN_PASS}" \ --data-dir=/data @@ -183,6 +184,12 @@ if occ config:system:get installed >/dev/null 2>&1; then if ! occ config:system:get upgrade.disable-web >/dev/null 2>&1; then occ config:system:set upgrade.disable-web --value=true --type=boolean fi + + # Set admin password + if [[ "${ADMIN_PASS+x}" ]]; then + echo "Setting admin password" + occ user:resetpassword --password-from-env "${ADMIN_USER:-admin}" + fi else echo "After completing the web-based installer, restart the Nextcloud container to apply default memory caching and transactional file locking configurations." echo "Alternatively, you can apply your own configurations by editing /config/www/nextcloud/config/config.php following the documentation:" diff --git a/root/usr/bin/occ b/root/usr/bin/occ index a08d55e..b984acc 100755 --- a/root/usr/bin/occ +++ b/root/usr/bin/occ @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -sudo -u abc -s /bin/bash -c "php /app/www/public/occ $*" +export NC_PASS=${ADMIN_PASS} +sudo -E -u abc -s /bin/bash -c "php /app/www/public/occ $*"