Add admin password reset

This commit is contained in:
Fabian Arndt 2025-09-13 02:47:34 +02:00
parent 6bfe392a35
commit 7f0c54263e
2 changed files with 9 additions and 1 deletions

View File

@ -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:"

View File

@ -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 $*"