fix: add Antigravity prereq check to all setup scripts (#7)
All three setup scripts (Linux, macOS, Windows) now verify that the Antigravity app is installed and the LS binary exists before proceeding. Fails early with a clear error message and suggestions instead of a cryptic runtime crash. Closes #5
This commit is contained in:
@@ -18,7 +18,26 @@ if [ ${#MISSING[@]} -gt 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 1. System user for UID isolation ──
|
# ── 1. Prerequisite check: Antigravity must be installed ──
|
||||||
|
LS_BINARY="${ZEROGRAVITY_LS_PATH:-/usr/share/antigravity/resources/app/extensions/antigravity/bin/language_server_linux_x64}"
|
||||||
|
echo "→ Checking for Antigravity installation…"
|
||||||
|
if [ ! -f "$LS_BINARY" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "✗ Antigravity is not installed (or the LS binary is missing)."
|
||||||
|
echo " ZeroGravity requires a working Antigravity installation."
|
||||||
|
echo " The Language Server binary is bundled with the Antigravity app"
|
||||||
|
echo " and cannot be downloaded separately."
|
||||||
|
echo ""
|
||||||
|
echo " Expected path:"
|
||||||
|
echo " $LS_BINARY"
|
||||||
|
echo ""
|
||||||
|
echo " Install Antigravity first, then re-run this script."
|
||||||
|
echo " Alternatively, set ZEROGRAVITY_LS_PATH to a custom LS binary location."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo " Found: $LS_BINARY"
|
||||||
|
|
||||||
|
# ── 2. System user for UID isolation ──
|
||||||
echo "→ Creating zerogravity-ls system user…"
|
echo "→ Creating zerogravity-ls system user…"
|
||||||
if id -u zerogravity-ls &>/dev/null; then
|
if id -u zerogravity-ls &>/dev/null; then
|
||||||
echo " Already exists."
|
echo " Already exists."
|
||||||
@@ -27,7 +46,7 @@ else
|
|||||||
echo " Created."
|
echo " Created."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 2. Sudoers rule (run commands as zerogravity-ls without password) ──
|
# ── 3. Sudoers rule (run commands as zerogravity-ls without password) ──
|
||||||
SUDOERS="/etc/sudoers.d/zerogravity"
|
SUDOERS="/etc/sudoers.d/zerogravity"
|
||||||
echo "→ Installing sudoers rule…"
|
echo "→ Installing sudoers rule…"
|
||||||
if [ -f "$SUDOERS" ]; then
|
if [ -f "$SUDOERS" ]; then
|
||||||
@@ -38,16 +57,16 @@ else
|
|||||||
echo " Installed: $SUDOERS"
|
echo " Installed: $SUDOERS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── 3. Data directory permissions ──
|
# ── 4. Data directory permissions ──
|
||||||
echo "→ Setting up /tmp/zerogravity-standalone…"
|
echo "→ Setting up /tmp/zerogravity-standalone…"
|
||||||
sudo mkdir -p /tmp/zerogravity-standalone
|
sudo mkdir -p /tmp/zerogravity-standalone
|
||||||
sudo chmod 1777 /tmp/zerogravity-standalone
|
sudo chmod 1777 /tmp/zerogravity-standalone
|
||||||
|
|
||||||
# ── 4. Config directory ──
|
# ── 5. Config directory ──
|
||||||
echo "→ Setting up ~/.config/zerogravity…"
|
echo "→ Setting up ~/.config/zerogravity…"
|
||||||
mkdir -p "$HOME/.config/zerogravity"
|
mkdir -p "$HOME/.config/zerogravity"
|
||||||
|
|
||||||
# ── 5. Systemd user service ──
|
# ── 6. Systemd user service ──
|
||||||
echo "→ Installing systemd user service…"
|
echo "→ Installing systemd user service…"
|
||||||
UNIT_DIR="$HOME/.config/systemd/user"
|
UNIT_DIR="$HOME/.config/systemd/user"
|
||||||
mkdir -p "$UNIT_DIR"
|
mkdir -p "$UNIT_DIR"
|
||||||
@@ -73,7 +92,7 @@ systemctl --user daemon-reload
|
|||||||
echo " Installed: $UNIT_DIR/zerogravity.service"
|
echo " Installed: $UNIT_DIR/zerogravity.service"
|
||||||
echo " Enable with: systemctl --user enable zerogravity"
|
echo " Enable with: systemctl --user enable zerogravity"
|
||||||
|
|
||||||
# ── 6. Build ──
|
# ── 7. Build ──
|
||||||
echo "→ Building release binary…"
|
echo "→ Building release binary…"
|
||||||
cd "$PROJECT_DIR"
|
cd "$PROJECT_DIR"
|
||||||
cargo build --release 2>&1 | tail -1
|
cargo build --release 2>&1 | tail -1
|
||||||
|
|||||||
@@ -16,7 +16,35 @@ mkdir -p "$CONFIG_DIR"
|
|||||||
echo "→ Setting up /tmp/zerogravity-standalone…"
|
echo "→ Setting up /tmp/zerogravity-standalone…"
|
||||||
mkdir -p /tmp/zerogravity-standalone
|
mkdir -p /tmp/zerogravity-standalone
|
||||||
|
|
||||||
# ── 3. Launchd plist ──
|
# ── 3. Prerequisite check: Antigravity must be installed ──
|
||||||
|
LS_BINARY="${ZEROGRAVITY_LS_PATH:-}"
|
||||||
|
if [ -z "$LS_BINARY" ]; then
|
||||||
|
# Check both /Applications and ~/Applications
|
||||||
|
for base in "/Applications/Antigravity.app" "$HOME/Applications/Antigravity.app"; do
|
||||||
|
candidate="$base/Contents/Resources/app/extensions/antigravity/bin/language_server_darwin_arm64"
|
||||||
|
if [ -f "$candidate" ]; then
|
||||||
|
LS_BINARY="$candidate"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
echo "→ Checking for Antigravity installation…"
|
||||||
|
if [ -z "$LS_BINARY" ] || [ ! -f "$LS_BINARY" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "✗ Antigravity is not installed (or the LS binary is missing)."
|
||||||
|
echo " ZeroGravity requires a working Antigravity installation."
|
||||||
|
echo " The Language Server binary is bundled with the Antigravity app"
|
||||||
|
echo " and cannot be downloaded separately."
|
||||||
|
echo ""
|
||||||
|
echo " Expected in: /Applications/Antigravity.app or ~/Applications/Antigravity.app"
|
||||||
|
echo ""
|
||||||
|
echo " Install Antigravity first, then re-run this script."
|
||||||
|
echo " Alternatively, set ZEROGRAVITY_LS_PATH to a custom LS binary location."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo " Found: $LS_BINARY"
|
||||||
|
|
||||||
|
# ── 4. Launchd plist ──
|
||||||
echo "→ Installing launchd plist…"
|
echo "→ Installing launchd plist…"
|
||||||
PLIST_DIR="$HOME/Library/LaunchAgents"
|
PLIST_DIR="$HOME/Library/LaunchAgents"
|
||||||
PLIST="$PLIST_DIR/com.zerogravity.proxy.plist"
|
PLIST="$PLIST_DIR/com.zerogravity.proxy.plist"
|
||||||
@@ -55,7 +83,7 @@ echo " Installed: $PLIST"
|
|||||||
echo " Start with: launchctl load $PLIST"
|
echo " Start with: launchctl load $PLIST"
|
||||||
echo " Stop with: launchctl unload $PLIST"
|
echo " Stop with: launchctl unload $PLIST"
|
||||||
|
|
||||||
# ── 4. Build ──
|
# ── 5. Build ──
|
||||||
echo "→ Building release binary…"
|
echo "→ Building release binary…"
|
||||||
cd "$PROJECT_DIR"
|
cd "$PROJECT_DIR"
|
||||||
cargo build --release 2>&1 | tail -1
|
cargo build --release 2>&1 | tail -1
|
||||||
|
|||||||
@@ -19,7 +19,26 @@ $DataDir = Join-Path $env:TEMP "zerogravity-standalone"
|
|||||||
New-Item -ItemType Directory -Force -Path $DataDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $DataDir | Out-Null
|
||||||
Write-Host " $DataDir"
|
Write-Host " $DataDir"
|
||||||
|
|
||||||
# ── 3. Build ──
|
# ── 3. Prerequisite check: Antigravity must be installed ──
|
||||||
|
Write-Host "→ Checking for Antigravity installation…"
|
||||||
|
$LsBinary = Join-Path $env:LOCALAPPDATA "Programs\Antigravity\resources\app\extensions\antigravity\bin\language_server_windows_x64.exe"
|
||||||
|
if (-not (Test-Path $LsBinary)) {
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "✗ Antigravity is not installed (or the LS binary is missing)." -ForegroundColor Red
|
||||||
|
Write-Host " ZeroGravity requires a working Antigravity installation."
|
||||||
|
Write-Host " The Language Server binary is bundled with the Antigravity app"
|
||||||
|
Write-Host " and cannot be downloaded separately."
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " Expected path:"
|
||||||
|
Write-Host " $LsBinary"
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " Install Antigravity first, then re-run this script."
|
||||||
|
Write-Host " Alternatively, set ZEROGRAVITY_LS_PATH to a custom LS binary location."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
Write-Host " Found: $LsBinary"
|
||||||
|
|
||||||
|
# ── 4. Build ──
|
||||||
Write-Host "→ Building release binary…"
|
Write-Host "→ Building release binary…"
|
||||||
Push-Location $ProjectDir
|
Push-Location $ProjectDir
|
||||||
cargo build --release
|
cargo build --release
|
||||||
@@ -32,7 +51,7 @@ if (-not (Test-Path $Binary)) {
|
|||||||
}
|
}
|
||||||
Write-Host " Built: $Binary"
|
Write-Host " Built: $Binary"
|
||||||
|
|
||||||
# ── 4. Scheduled task (optional) ──
|
# ── 5. Scheduled task (optional) ──
|
||||||
$TaskName = "ZeroGravity Proxy"
|
$TaskName = "ZeroGravity Proxy"
|
||||||
$Existing = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
$Existing = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user