diff --git a/skills/scripts/bootstrap-reverse.sh b/skills/scripts/bootstrap-reverse.sh index 647cb65..9ec06e4 100644 --- a/skills/scripts/bootstrap-reverse.sh +++ b/skills/scripts/bootstrap-reverse.sh @@ -143,14 +143,13 @@ sudo_cmd() { is_kali() { [[ -f /etc/os-release ]] || return 1 - local line lowered + local line while IFS= read -r line || [[ -n "$line" ]]; do - lowered="$(printf '%s\n' "$line" | tr '[:upper:]' '[:lower:]')" - case "$lowered" in - id_like=*) continue ;; - id=*) - case "$lowered" in - *kali*) return 0 ;; + case "$line" in + ID_LIKE=*|id_like=*) continue ;; + ID=*|id=*) + case "$line" in + *[Kk][Aa][Ll][Ii]*) return 0 ;; esac ;; esac diff --git a/skills/scripts/test-bootstrap-manifest.sh b/skills/scripts/test-bootstrap-manifest.sh index 7909484..de98039 100644 --- a/skills/scripts/test-bootstrap-manifest.sh +++ b/skills/scripts/test-bootstrap-manifest.sh @@ -16,6 +16,10 @@ cat > "$STUB_BIN/command-stub" <<'STUB' #!/usr/bin/env bash name="$(basename "$0")" { printf '%s' "$name"; for arg in "$@"; do printf '|%s' "$arg"; done; printf '\n'; } >> "$CALL_LOG" +if [[ "$name" == sudo ]]; then + next="${1:-}"; shift || true + exec "$(dirname "$0")/$next" "$@" +fi case "$name:${1:-}" in pipx:--version) printf '%s\n' "${STUB_PIPX_VERSION:-0}" ;; pnpm:--version) printf '%s\n' "${STUB_PNPM_VERSION:-0}" ;; @@ -24,6 +28,12 @@ case "$name:${1:-}" in ln -sf "$STUB_PYTHON_SOURCE" "$STUB_ACTIVE_BIN/python3" fi ;; + apt-get:install) + pkg="${3:-${2:-}}" + if [[ "$pkg" == python3 ]]; then + ln -sf "$STUB_PYTHON_SOURCE" "$STUB_ACTIVE_BIN/python3" + fi + ;; git:init) target="${!#}"; mkdir -p "$target/.git"; printf '%s\n' unpinned-head > "$target/.stub-head" ;; @@ -47,7 +57,7 @@ esac [[ "${STUB_FAIL_COMMAND:-}" != "$name" ]] STUB chmod +x "$STUB_BIN/command-stub" -for name in git node npm npx pipx pnpm sleep nc; do ln -s command-stub "$STUB_BIN/$name"; done +for name in git node npm npx pipx pnpm sleep nc apt-get sudo; do ln -s command-stub "$STUB_BIN/$name"; done ln -s command-stub "$STUB_BIN/brew" cat > "$STUB_BIN/python3" < "$CALL_LOG" -env PATH="$NO_PYTHON_BIN" HOME="$SCRATCH/home" CALL_LOG="$CALL_LOG" \ +if ! env PATH="$NO_PYTHON_BIN" HOME="$SCRATCH/home" CALL_LOG="$CALL_LOG" \ STUB_ACTIVE_BIN="$NO_PYTHON_BIN" STUB_PYTHON_SOURCE="$STUB_BIN/python3" \ REVERSE_SKILL_TOOLS_DIR="$SCRATCH/tools" CLAUDE_MCP_CONFIG="$SCRATCH/home/mcp.json" \ - bash "$PARSER_FIXTURE/bootstrap-reverse.sh" agent-browser --skip-refresh >/dev/null -expect_line 'brew|install|python' + bash "$PARSER_FIXTURE/bootstrap-reverse.sh" agent-browser --skip-refresh \ + >"$SCRATCH/parser-out.log" 2>&1; then + echo "parser-bootstrap failed:" >&2 + cat "$SCRATCH/parser-out.log" >&2 + exit 1 +fi +if [[ "$(uname -s)" == Darwin ]]; then + expect_line 'brew|install|python' +else + expect_line 'apt-get|install|-y|python3' +fi expect_line "npm|install|-g|$(json_value agent-browser npmPackage)" ! grep -Fq '|pip|install|' "$CALL_LOG"