Update install.sh

This commit is contained in:
saifuddin 2026-06-22 10:55:45 +00:00
parent 5d0e185868
commit cba3430395

View File

@ -7,7 +7,6 @@ YELLOW='\033[1;33m'
RESET='\033[0m' RESET='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
HERMES_AGENT_DIR="$HOME/.hermes/hermes-agent"
PATCHES_DIR="$HOME/.hermes/patches" PATCHES_DIR="$HOME/.hermes/patches"
MARKER="# hermes-claude-auth managed" MARKER="# hermes-claude-auth managed"
@ -62,34 +61,6 @@ fi
chmod 644 "$SITECUSTOMIZE" chmod 644 "$SITECUSTOMIZE"
printf "${GREEN}[✓] Installed hook into %s${RESET}\n" "$SITECUSTOMIZE" printf "${GREEN}[✓] Installed hook into %s${RESET}\n" "$SITECUSTOMIZE"
# macOS: hermes-agent reads Claude subscription credentials from
# ~/.claude/.credentials.json, but Claude Code on macOS stores them in
# Keychain only. Mirror the Keychain entry into the file so auth works
# out of the box. No-op on Linux (Claude Code writes the file directly).
if [ "$(uname -s)" = "Darwin" ]; then
CRED_FILE="$HOME/.claude/.credentials.json"
if KEYCHAIN_CRED="$(security find-generic-password -s 'Claude Code-credentials' -w 2>/dev/null)"; then
mkdir -p "$(dirname "$CRED_FILE")"
if [ ! -f "$CRED_FILE" ] || [ "$(cat "$CRED_FILE" 2>/dev/null)" != "$KEYCHAIN_CRED" ]; then
printf '%s' "$KEYCHAIN_CRED" > "$CRED_FILE"
chmod 600 "$CRED_FILE"
printf "${GREEN}[✓] Mirrored Claude Code credentials from Keychain → %s${RESET}\n" "$CRED_FILE"
else
printf "${GREEN}[✓] Claude Code credentials file already matches Keychain${RESET}\n"
fi
elif [ ! -f "$CRED_FILE" ]; then
printf "${YELLOW}[!] macOS detected but no 'Claude Code-credentials' Keychain entry found${RESET}\n"
printf " Run: claude auth login --claudeai\n"
fi
fi
if systemctl --user is-active hermes-gateway.service >/dev/null 2>&1; then
systemctl --user restart hermes-gateway.service
printf "${GREEN}[✓] Restarted hermes-gateway.service${RESET}\n"
else
printf "${YELLOW}[!] hermes-gateway not running — restart manually when ready${RESET}\n"
fi
printf "\n${GREEN}Installation complete.${RESET}\n" printf "\n${GREEN}Installation complete.${RESET}\n"
printf " Patch: %s/anthropic_billing_bypass.py\n" "$PATCHES_DIR" printf " Patch: %s/anthropic_billing_bypass.py\n" "$PATCHES_DIR"
printf " Hook: %s\n" "$SITECUSTOMIZE" printf " Hook: %s\n" "$SITECUSTOMIZE"