Skip to content

Commit 88e5a8c

Browse files
committed
small fixes for the devcontainer setup script
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
1 parent 8e6b276 commit 88e5a8c

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

.devcontainer/setup.sh

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,59 @@ echo "→ Running bootstrap (Apache + Nextcloud installer)…"
4545
(cd /tmp && sudo -E /usr/local/bin/bootstrap.sh apache2ctl start)
4646

4747
# Wait for the background installer to finish (up to 5 minutes).
48-
echo "→ Waiting for Nextcloud installation to complete…"
48+
# Fun messages are printed every 10 seconds to keep the developer entertained.
49+
FUN_TASKS=(
50+
"Summoning PHP 8.3 🐘"
51+
"Cloning Nextcloud ${SERVER_BRANCH:-master} 🌿"
52+
"Setting up the database 🗄️"
53+
"Running maintenance:install 🔧"
54+
"Enabling apps 🧩"
55+
"Configuring Apache 🪁"
56+
"Calibrating Xdebug 🔍"
57+
"Feeding the RSS gnomes 📰"
58+
"Polishing the user interface ✨"
59+
"Teaching owls to hoot 🦉"
60+
"Brewing extra coffee ☕"
61+
"Checking for gremlins 🐛"
62+
"Untangling spaghetti code 🍝"
63+
"Counting database rows 🔢"
64+
"Crossing fingers 🤞"
65+
"Chanting install mantras 🙏"
66+
"Bribing the build gods ⚡"
67+
"Asking the PHP fairy nicely 🧚"
68+
"Definitely almost done ⏳"
69+
)
70+
TASK_INDEX=0
4971
TIMEOUT=300
5072
ELAPSED=0
73+
74+
echo "→ Waiting for Nextcloud installation to complete…"
75+
echo ""
76+
5177
until sudo -u www-data php "$WEBROOT/occ" status 2>/dev/null | grep -q "installed: true"; do
5278
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
79+
echo ""
5380
echo "✘ Timed out waiting for Nextcloud installation" >&2
5481
exit 1
5582
fi
5683
sleep 5
5784
ELAPSED=$((ELAPSED + 5))
58-
printf "\r %ds / %ds…" "$ELAPSED" "$TIMEOUT"
85+
# Print a new "completed task" every 10 seconds to entertain the developer.
86+
if [ "$ELAPSED" -gt "0" ] && [ "$(( ELAPSED % 10 ))" -eq "0" ]; then
87+
printf " ✔ %s\n" "${FUN_TASKS[$TASK_INDEX]}"
88+
TASK_INDEX=$(( (TASK_INDEX + 1) % ${#FUN_TASKS[@]} ))
89+
fi
5990
done
6091
echo ""
6192
echo "✔ Nextcloud installed"
6293

94+
# Disable the profiler. The dev base image enables it by default; it must be
95+
# turned off after the installer finishes writing config.php (any earlier
96+
# attempt races against the background installer and gets overwritten).
97+
echo "→ Disabling Nextcloud profiler…"
98+
sudo -u www-data php "$WEBROOT/occ" config:system:set profiler --value=false --type=bool
99+
echo "✔ Profiler disabled"
100+
63101
# Fix ownership so the vscode developer can read/write these directories
64102
# without sudo. Apache (www-data) retains access via group membership.
65103
echo "→ Fixing permissions for development…"
@@ -70,4 +108,11 @@ for dir in config data apps-writable apps-extra apps-shared; do
70108
sudo chmod -R g+rwX "$target"
71109
done
72110

73-
echo "✔ Nextcloud is ready at http://localhost (admin / admin)"
111+
# Bootstrap runs as root (via sudo -E), so any Nextcloud temp files it created
112+
# in /tmp are owned by root. Remove them so the vscode user can recreate them
113+
# with the correct owner on the first `./occ` run (otherwise FileSequence
114+
# finds a root-owned directory that exists but is not writable).
115+
sudo find /tmp -maxdepth 1 -type d -user root \( -name 'oc_*' -o -name 'nc_*' \) \
116+
-exec rm -rf {} + 2>/dev/null || true
117+
118+
echo "✔ Nextcloud is ready at http://localhost (admin / admin)"

0 commit comments

Comments
 (0)