Files
planet/scripts/windows/restart.zsh
rayd1o 003b316d42
Some checks failed
ci / backend (push) Has been cancelled
ci / frontend (push) Has been cancelled
ci / delivery (push) Has been cancelled
release / images (push) Has been cancelled
release: bump version to 0.75.1
2026-09-25 00:16:30 +08:00

31 lines
1.2 KiB
Bash

#!/usr/bin/env zsh
# Locate the repository from this file, independent of Windows/WSL working directories.
project_root="${0:A:h:h:h}"
cd -- "$project_root" || exit 1
./planet.sh restart --allow-lan
planet_exit=$?
print
if (( planet_exit == 0 )); then
print 'Planet restart finished successfully.'
frontend_port=3000
frontend_scheme=http
port_state="${PLANET_STATE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/planet}/ports.env"
if [[ -f "$port_state" ]]; then
while IFS='=' read -r key value; do
case "$key" in
FRONTEND_PORT) [[ "$value" == <1-65535> ]] && frontend_port="$value" ;;
FRONTEND_SCHEME) [[ "$value" == http || "$value" == https ]] && frontend_scheme="$value" ;;
esac
done < "$port_state"
fi
WSLENV="${WSLENV:+$WSLENV:}PLANET_LAUNCH_URL" \
PLANET_LAUNCH_URL="${frontend_scheme}://localhost:${frontend_port}/earth" \
powershell.exe -NoProfile -Command 'Start-Process $env:PLANET_LAUNCH_URL'
else
print "Planet restart failed with exit code $planet_exit."
fi
print
print 'Staying in WSL. Close this terminal manually when you are done.'
exec zsh -l