forked from devcontainers-extra/features
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
29 lines (22 loc) 路 1.06 KB
/
Copy pathinstall.sh
File metadata and controls
29 lines (22 loc) 路 1.06 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
#!/usr/bin/env bash
set -e
# Make sure that variable _REMOTE_USER_HOME is properly set
if [ -z "$_REMOTE_USER_HOME" ]; then
# shellcheck disable=2016 # this is intentional as the expansion should happen in the context of the new session
_REMOTE_USER_HOME="$(su - "$_REMOTE_USER" -c 'echo "$HOME"')"
export _REMOTE_USER_HOME
fi
# Install via Anthropic's recommended method
# Script downloaded from them:
# https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/bootstrap.sh
# Resolve the absolute path before su changes the working directory
BOOTSTRAP_SCRIPT="$(pwd)/bootstrap.sh"
# Run as the devcontainer user so that ~/.claude/, ~/.local/bin/claude, and
# ~/.local/share/claude/ are owned by the right user, not root.
su - "$_REMOTE_USER" <<EOF
bash "$BOOTSTRAP_SCRIPT" "$VERSION"
EOF
# Copy the binary to /usr/local/bin for global access
# It's installed in ~/.local/bin/claude and there's no option to override the install location
cp "$_REMOTE_USER_HOME/.local/bin/claude" /usr/local/bin/claude
echo 'Done!'