#!/bin/sh # Installs Agent Village (Pixlage) on macOS or Linux: # # curl -fsSL https://pixlage.app/install.sh | sh # # Files that curl downloads carry no quarantine mark, so macOS opens the app without the Gatekeeper prompt a # browser download gets. Running it again updates to the latest release; your villagers and settings are kept. set -eu RELEASES="https://github.com/Nofyz/agent-village-releases/releases/latest/download" APP="Agent Village" BUNDLE_ID="com.agentvillage.app" say() { printf '\033[1;33m>\033[0m %s\n' "$1"; } ok() { printf '\033[1;32m+\033[0m %s\n' "$1"; } fail() { printf '\033[1;31mx\033[0m %s\n' "$1" >&2; exit 1; } command -v curl >/dev/null 2>&1 || fail "curl is required." tmp=$(mktemp -d) mount="" cleanup() { if [ -n "$mount" ]; then hdiutil detach -quiet "$mount" 2>/dev/null || true; fi rm -rf "$tmp" } trap cleanup EXIT INT TERM download() { say "Downloading $1" curl -fL --progress-bar "$RELEASES/$1" -o "$tmp/$1" || fail "Could not download $RELEASES/$1" } install_mac() { download Agent-Village-macOS.dmg mount="$tmp/volume" mkdir "$mount" hdiutil attach -nobrowse -readonly -quiet -mountpoint "$mount" "$tmp/Agent-Village-macOS.dmg" || fail "Could not open the disk image." # /Applications needs an admin account; anyone else gets their own ~/Applications. dest="/Applications" [ -w "$dest" ] || { dest="$HOME/Applications"; mkdir -p "$dest"; } if [ "$(osascript -e "application id \"$BUNDLE_ID\" is running" 2>/dev/null || echo false)" = "true" ]; then say "Closing the running $APP" osascript -e "tell application id \"$BUNDLE_ID\" to quit" >/dev/null 2>&1 || true i=0 while [ "$(osascript -e "application id \"$BUNDLE_ID\" is running" 2>/dev/null || echo false)" = "true" ] && [ $i -lt 20 ]; do sleep 0.5 i=$((i + 1)) done fi say "Copying $APP to $dest" rm -rf "$dest/$APP.app" ditto "$mount/$APP.app" "$dest/$APP.app" || fail "Could not copy the app to $dest." xattr -dr com.apple.quarantine "$dest/$APP.app" 2>/dev/null || true ok "$APP is installed in $dest." open "$dest/$APP.app" ok "Look for its icon in the menu bar." } install_linux() { [ "$(uname -m)" = "x86_64" ] || fail "Agent Village for Linux is built for x86_64 only." sudo="" [ "$(id -u)" -eq 0 ] || sudo="sudo" if command -v apt-get >/dev/null 2>&1; then download Agent-Village-Linux.deb # apt reads the package as an unprivileged user; let it see the file. chmod 755 "$tmp" chmod 644 "$tmp/Agent-Village-Linux.deb" say "Installing the .deb package (this asks for your password)" $sudo apt-get install -y "$tmp/Agent-Village-Linux.deb" || fail "apt could not install the package." run="agent-village" ok "$APP is installed. Open it from your apps menu, or run: agent-village" else download Agent-Village-Linux.AppImage dest="$HOME/Applications" mkdir -p "$dest" mv "$tmp/Agent-Village-Linux.AppImage" "$dest/Agent-Village.AppImage" chmod +x "$dest/Agent-Village.AppImage" run="$dest/Agent-Village.AppImage" ok "$APP is installed at $run" fi if [ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]; then nohup "$run" >/dev/null 2>&1 & ok "Look for its icon in the system tray." fi } case "$(uname -s)" in Darwin) install_mac ;; Linux) install_linux ;; *) fail "This script is for macOS and Linux. On Windows, run in PowerShell: irm https://pixlage.app/install.ps1 | iex" ;; esac