From 45b5cc15e0957f9706bb1ce0efb6be1ca40639b7 Mon Sep 17 00:00:00 2001 From: Nikketryhard Date: Wed, 18 Feb 2026 13:54:43 -0600 Subject: [PATCH] refactor: remove automatic service/task installation from Linux, macOS, and Windows setup scripts. --- scripts/setup-linux.sh | 32 +++----------------------- scripts/setup-macos.sh | 47 +++------------------------------------ scripts/setup-windows.ps1 | 36 ++---------------------------- 3 files changed, 8 insertions(+), 107 deletions(-) diff --git a/scripts/setup-linux.sh b/scripts/setup-linux.sh index 689c880..fd4362d 100755 --- a/scripts/setup-linux.sh +++ b/scripts/setup-linux.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # ZeroGravity — Linux setup -# Creates the zerogravity-ls system user for UID-scoped iptables isolation, -# installs the systemd user service, and builds the dns_redirect.so preload lib. +# Checks prerequisites, creates the zerogravity-ls system user for +# UID-scoped iptables isolation, and builds the release binary. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" @@ -66,33 +66,7 @@ sudo chmod 1777 /tmp/zerogravity-standalone echo "→ Setting up ~/.config/zerogravity…" mkdir -p "$HOME/.config/zerogravity" -# ── 6. Systemd user service ── -echo "→ Installing systemd user service…" -UNIT_DIR="$HOME/.config/systemd/user" -mkdir -p "$UNIT_DIR" -cat > "$UNIT_DIR/zerogravity.service" << EOF -[Unit] -Description=ZeroGravity Proxy -After=network.target - -[Service] -Type=simple -ExecStart=$PROJECT_DIR/target/release/zerogravity -WorkingDirectory=$PROJECT_DIR -Environment=RUST_LOG=info -Restart=on-failure -RestartSec=3 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=default.target -EOF -systemctl --user daemon-reload -echo " Installed: $UNIT_DIR/zerogravity.service" -echo " Enable with: systemctl --user enable zerogravity" - -# ── 7. Build ── +# ── 6. Build ── echo "→ Building release binary…" cd "$PROJECT_DIR" cargo build --release 2>&1 | tail -1 diff --git a/scripts/setup-macos.sh b/scripts/setup-macos.sh index 7697049..ce14c84 100755 --- a/scripts/setup-macos.sh +++ b/scripts/setup-macos.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # ZeroGravity — macOS setup -# Installs a launchd plist for automatic startup and sets up config directories. +# Checks prerequisites, sets up config directories, and builds the release binary. # No UID isolation on macOS — runs in headless/HTTPS_PROXY mode only. set -euo pipefail @@ -44,50 +44,9 @@ if [ -z "$LS_BINARY" ] || [ ! -f "$LS_BINARY" ]; then fi echo " Found: $LS_BINARY" -# ── 4. Launchd plist ── -echo "→ Installing launchd plist…" -PLIST_DIR="$HOME/Library/LaunchAgents" -PLIST="$PLIST_DIR/com.zerogravity.proxy.plist" -mkdir -p "$PLIST_DIR" -cat > "$PLIST" << EOF - - - - - Label - com.zerogravity.proxy - ProgramArguments - - $PROJECT_DIR/target/release/zerogravity - - WorkingDirectory - $PROJECT_DIR - EnvironmentVariables - - RUST_LOG - info - - KeepAlive - - SuccessfulExit - - - StandardOutPath - $HOME/Library/Logs/zerogravity.log - StandardErrorPath - $HOME/Library/Logs/zerogravity.log - - -EOF -echo " Installed: $PLIST" -echo " Start with: launchctl load $PLIST" -echo " Stop with: launchctl unload $PLIST" - -# ── 5. Build ── +# ── 4. Build ── echo "→ Building release binary…" cd "$PROJECT_DIR" cargo build --release 2>&1 | tail -1 echo "" -echo "✓ Setup complete." -echo " Start with: launchctl load $PLIST" -echo " Or manually: zg start" +echo "✓ Setup complete. Start with: zg start" diff --git a/scripts/setup-windows.ps1 b/scripts/setup-windows.ps1 index cf1cfcb..a0f9e5f 100644 --- a/scripts/setup-windows.ps1 +++ b/scripts/setup-windows.ps1 @@ -1,6 +1,5 @@ # ZeroGravity — Windows setup -# Creates config directories, builds the release binary, and optionally -# installs as a scheduled task for automatic startup. +# Creates config directories, checks prerequisites, and builds the release binary. # Run as: powershell -ExecutionPolicy Bypass -File scripts\setup-windows.ps1 $ErrorActionPreference = "Stop" @@ -51,37 +50,6 @@ if (-not (Test-Path $Binary)) { } Write-Host " Built: $Binary" -# ── 5. Scheduled task (optional) ── -$TaskName = "ZeroGravity Proxy" -$Existing = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue - -if ($Existing) { - Write-Host "→ Scheduled task '$TaskName' already exists. Updating…" - Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false -} - -Write-Host "→ Creating scheduled task '$TaskName'…" -$Action = New-ScheduledTaskAction ` - -Execute $Binary ` - -WorkingDirectory $ProjectDir - -$Trigger = New-ScheduledTaskTrigger -AtLogOn -$Settings = New-ScheduledTaskSettingsSet ` - -AllowStartIfOnBatteries ` - -DontStopIfGoingOnBatteries ` - -RestartCount 3 ` - -RestartInterval (New-TimeSpan -Minutes 1) - -Register-ScheduledTask ` - -TaskName $TaskName ` - -Action $Action ` - -Trigger $Trigger ` - -Settings $Settings ` - -Description "ZeroGravity OpenAI-compatible proxy" | Out-Null - -Write-Host " Installed as logon task." Write-Host "" Write-Host "✓ Setup complete." -Write-Host " Start now: schtasks /run /tn '$TaskName'" -Write-Host " Stop: schtasks /end /tn '$TaskName'" -Write-Host " Or manually: .\target\release\zerogravity.exe" +Write-Host " Start: .\target\release\zerogravity.exe"