Skip to content

Commit 031382f

Browse files
Copilotrentziass
andcommitted
Add waiter script to wait for dotfiles install completion
Co-authored-by: rentziass <6207785+rentziass@users.noreply.github.com>
1 parent dd9b6cd commit 031382f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

bin/.local/bin/waiter

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
# Waiter script: waits for dotfiles install to complete and then launches zsh
4+
# This is useful when connecting to codespaces during setup
5+
6+
MAX_WAIT=300 # Maximum wait time in seconds (5 minutes)
7+
INTERVAL=2 # Check interval in seconds
8+
elapsed=0
9+
10+
echo "Waiting for dotfiles install to complete..."
11+
12+
# Check for starship as an indicator that dotfiles setup is complete
13+
# The install script runs starship installation as one of its steps
14+
while ! command -v starship &> /dev/null; do
15+
if [ $elapsed -ge $MAX_WAIT ]; then
16+
echo ""
17+
echo "Timeout: dotfiles install did not complete within $MAX_WAIT seconds."
18+
exit 1
19+
fi
20+
echo -n "."
21+
sleep $INTERVAL
22+
elapsed=$((elapsed + INTERVAL))
23+
done
24+
25+
echo ""
26+
echo "Dotfiles setup complete! Launching zsh..."
27+
28+
if command -v zsh &> /dev/null; then
29+
exec zsh
30+
else
31+
echo "Warning: zsh not available, falling back to current shell."
32+
fi

0 commit comments

Comments
 (0)