install.sh: install Claude Code if not already present
Adds a step after personal-dotfile deploy that runs Anthropic's official one-liner installer (curl -fsSL https://claude.ai/install.sh | bash) when no 'claude' binary is found. No-ops if claude is already on the machine. Opt out with DRUNKENDOTFILES_SKIP_CLAUDE=1. Install failures are non-fatal — the rest of the flow still completes. README: document the new step + the opt-out env var + curl in the required tools list.
This commit is contained in:
@@ -33,8 +33,11 @@ The installer:
|
|||||||
2. Runs YADR's native `rake install` for vim/prezto/plugins
|
2. Runs YADR's native `rake install` for vim/prezto/plugins
|
||||||
3. Deploys the personal dotfiles on top of `$HOME`, moving any collisions to
|
3. Deploys the personal dotfiles on top of `$HOME`, moving any collisions to
|
||||||
`~/.drunkendotfiles.bak.<timestamp>/`
|
`~/.drunkendotfiles.bak.<timestamp>/`
|
||||||
|
4. Installs [Claude Code](https://claude.ai/code) (Anthropic's CLI) if it
|
||||||
|
isn't already on the machine — set `DRUNKENDOTFILES_SKIP_CLAUDE=1` to
|
||||||
|
skip this step
|
||||||
|
|
||||||
Requires `git` and `rake` (ruby).
|
Requires `git`, `rake` (ruby), and `curl`.
|
||||||
|
|
||||||
## Upgrading
|
## Upgrading
|
||||||
|
|
||||||
|
|||||||
20
install.sh
20
install.sh
@@ -110,10 +110,26 @@ for f in "${PERSONAL_FILES[@]}"; do deploy_one "$f"; done
|
|||||||
for d in "${PERSONAL_DIRS[@]}"; do deploy_one "$d"; done
|
for d in "${PERSONAL_DIRS[@]}"; do deploy_one "$d"; done
|
||||||
|
|
||||||
# .local/bin/claude is a relative symlink to ../share/claude/versions/...
|
# .local/bin/claude is a relative symlink to ../share/claude/versions/...
|
||||||
# If that target isn't present on this machine, remove the dangling link.
|
# If that target isn't present on this machine, remove the dangling link so
|
||||||
|
# Claude Code's own installer (next step) can manage it.
|
||||||
if [ -L "$HOME/.local/bin/claude" ] && [ ! -e "$HOME/.local/bin/claude" ]; then
|
if [ -L "$HOME/.local/bin/claude" ] && [ ! -e "$HOME/.local/bin/claude" ]; then
|
||||||
rm "$HOME/.local/bin/claude"
|
rm "$HOME/.local/bin/claude"
|
||||||
info "(skipped .local/bin/claude: target not present on this machine)"
|
fi
|
||||||
|
|
||||||
|
# 4. Install Claude Code (Anthropic's CLI). Skip if already installed or
|
||||||
|
# explicitly opted out via DRUNKENDOTFILES_SKIP_CLAUDE=1.
|
||||||
|
if [ "${DRUNKENDOTFILES_SKIP_CLAUDE:-0}" = "1" ]; then
|
||||||
|
info "Skipping Claude Code install (DRUNKENDOTFILES_SKIP_CLAUDE=1)"
|
||||||
|
elif have claude || [ -x "$HOME/.local/bin/claude" ]; then
|
||||||
|
info "Claude Code already installed ($(claude --version 2>/dev/null || echo 'version unknown'))"
|
||||||
|
else
|
||||||
|
log "Installing Claude Code"
|
||||||
|
if have curl; then
|
||||||
|
curl -fsSL https://claude.ai/install.sh | bash \
|
||||||
|
|| warn "Claude Code install failed; continuing. Install manually with: curl -fsSL https://claude.ai/install.sh | bash"
|
||||||
|
else
|
||||||
|
warn "curl not found; skipping Claude Code install"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure +x on user scripts
|
# Ensure +x on user scripts
|
||||||
|
|||||||
Reference in New Issue
Block a user