-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·33 lines (26 loc) · 1.02 KB
/
install.sh
File metadata and controls
executable file
·33 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# References:
# - https://docs.anthropic.com/en/docs/claude-code/overview
set -eu
echo "Activating feature 'claude-code'"
_install_claude_code() {
if command -v curl >/dev/null; then
download_cmd="curl -fsSL https://claude.ai/install.sh"
elif command -v wget >/dev/null; then
download_cmd="wget -qO- https://claude.ai/install.sh"
else
echo "ERROR: curl or wget is required but neither was found!"
return 1
fi
# Install as remote user if running as root with non-root remote user
if [ "$(id -u)" = "0" ] && [ -n "${_REMOTE_USER:-}" ] && [ "$_REMOTE_USER" != "root" ]; then
su - "$_REMOTE_USER" -c "$download_cmd | bash"
else
$download_cmd | bash
fi
# Clean up config files generated by the installer to avoid stale state
_user_home="${_REMOTE_USER_HOME:-$(getent passwd "${_REMOTE_USER:-root}" | cut -d: -f6)}"
rm -Rf "$_user_home/.claude" "$_user_home/.claude.json"
}
_install_claude_code
echo "Claude Code installed successfully!"