Files
seal-use/scripts/install.sh
T
gitea 7f3a4b0fe4
Binaries / Build & Release Binaries (push) Has been cancelled
Update installer to use user-writable bin directory without sudo
2026-08-25 14:36:58 +08:00

82 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
REPO="yunyingk/seal-home"
echo "==> Detecting platform and architecture..."
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$OS" in
darwin)
PLATFORM="darwin"
;;
linux)
PLATFORM="linux"
;;
*)
echo "Unsupported operating system: $OS" >&2
exit 1
;;
esac
case "$ARCH" in
x86_64|amd64)
ARCH_NAME="x64"
;;
arm64|aarch64)
ARCH_NAME="arm64"
;;
*)
echo "Unsupported architecture: $ARCH" >&2
exit 1
;;
esac
# Resolve best writable bin directory without requiring sudo
TARGET_DIR=""
for candidate in "/opt/homebrew/bin" "/usr/local/bin" "$HOME/.local/bin" "$HOME/bin"; do
if [ -d "$candidate" ] && [ -w "$candidate" ]; then
TARGET_DIR="$candidate"
break
fi
done
if [ -z "$TARGET_DIR" ]; then
mkdir -p "$HOME/.local/bin"
TARGET_DIR="$HOME/.local/bin"
fi
ASSET_NAME="seal-home-${PLATFORM}-${ARCH_NAME}"
DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${ASSET_NAME}"
TARGET_PATH="${TARGET_DIR}/seal-home"
echo "==> Downloading seal-home (${PLATFORM}-${ARCH_NAME}) into ${TARGET_DIR}..."
TMP_FILE="$(mktemp)"
if ! curl -fL "$DOWNLOAD_URL" -o "$TMP_FILE"; then
echo "Error: Failed to download $DOWNLOAD_URL" >&2
rm -f "$TMP_FILE"
exit 1
fi
chmod +x "$TMP_FILE"
mv "$TMP_FILE" "$TARGET_PATH"
# Ad-hoc sign on macOS
if [ "$PLATFORM" = "darwin" ] && command -v codesign >/dev/null 2>&1; then
codesign --force --sign - "$TARGET_PATH" 2>/dev/null || true
fi
echo "==> Initializing agent skill..."
"$TARGET_PATH" skill install >/dev/null 2>&1 || true
echo ""
echo "✨ seal-home successfully installed to ${TARGET_PATH}!"
"$TARGET_PATH" version
echo ""
echo "Quick start:"
echo " 1. Add enterprise: seal-home corps add-hose --json '{...}'"
echo " 2. View MCP config: seal-home mcp-config"
echo " 3. Self-update: seal-home update"
echo ""