Skip to content

Commit 7f0c542

Browse files
committed
Add admin password reset
1 parent 6bfe392 commit 7f0c542

File tree

2 files changed

+9
-1
lines changed
  • root
    • etc/s6-overlay/s6-rc.d/init-nextcloud-config
    • usr/bin

2 files changed

+9
-1
lines changed

root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ if [[ -f /config/www/nextcloud/config/needs_migration ]] || [[ -f /tmp/needs_ins
138138
--database-name="${DB_NAME}" \
139139
--database-user="${DB_USER}" \
140140
--database-pass="${DB_PASS}" \
141+
--admin-user="${ADMIN_USER:-admin}" \
141142
--admin-pass="${ADMIN_PASS}" \
142143
--data-dir=/data
143144

@@ -183,6 +184,12 @@ if occ config:system:get installed >/dev/null 2>&1; then
183184
if ! occ config:system:get upgrade.disable-web >/dev/null 2>&1; then
184185
occ config:system:set upgrade.disable-web --value=true --type=boolean
185186
fi
187+
188+
# Set admin password
189+
if [[ "${ADMIN_PASS+x}" ]]; then
190+
echo "Setting admin password"
191+
occ user:resetpassword --password-from-env "${ADMIN_USER:-admin}"
192+
fi
186193
else
187194
echo "After completing the web-based installer, restart the Nextcloud container to apply default memory caching and transactional file locking configurations."
188195
echo "Alternatively, you can apply your own configurations by editing /config/www/nextcloud/config/config.php following the documentation:"

root/usr/bin/occ

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4-
sudo -u abc -s /bin/bash -c "php /app/www/public/occ $*"
4+
export NC_PASS=${ADMIN_PASS}
5+
sudo -E -u abc -s /bin/bash -c "php /app/www/public/occ $*"

0 commit comments

Comments
 (0)