diff --git a/sprite/claude.sh b/sprite/claude.sh index 271e89ae..360190d5 100755 --- a/sprite/claude.sh +++ b/sprite/claude.sh @@ -1,14 +1,11 @@ #!/bin/bash set -e -# Source common functions -# Check if running via curl | bash or locally -if [[ -n "${BASH_SOURCE[0]}" && "${BASH_SOURCE[0]}" != "-" && "${BASH_SOURCE[0]}" != "bash" ]]; then - # Running locally - source from local file - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Source common functions - try local file first, fall back to remote +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)" +if [[ -f "$SCRIPT_DIR/lib/common.sh" ]]; then source "$SCRIPT_DIR/lib/common.sh" else - # Running via curl | bash - download from GitHub source <(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/sprite/lib/common.sh) fi diff --git a/sprite/openclaw.sh b/sprite/openclaw.sh index bb29cc82..3aba373a 100755 --- a/sprite/openclaw.sh +++ b/sprite/openclaw.sh @@ -1,14 +1,11 @@ #!/bin/bash set -e -# Source common functions -# Check if running via curl | bash or locally -if [[ -n "${BASH_SOURCE[0]}" && "${BASH_SOURCE[0]}" != "-" && "${BASH_SOURCE[0]}" != "bash" ]]; then - # Running locally - source from local file - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Source common functions - try local file first, fall back to remote +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)" +if [[ -f "$SCRIPT_DIR/lib/common.sh" ]]; then source "$SCRIPT_DIR/lib/common.sh" else - # Running via curl | bash - download from GitHub source <(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/sprite/lib/common.sh) fi