@@ -37,25 +37,33 @@ trap 'rm -rf "$TMP_DIR"' EXIT
3737cd " $TMP_DIR "
3838
3939# Download the official install script from claude.ai
40+ # The script is the same regardless of version; version is passed as an argument
4041echo " Downloading Claude Code installer..."
41- if [ " $CLAUDE_VERSION " = " latest" ]; then
42- curl -fsSL https://claude.ai/install.sh -o install.sh
43- else
44- # The official script accepts version as an argument
45- curl -fsSL https://claude.ai/install.sh -o install.sh
46- fi
42+ curl -fsSL https://claude.ai/install.sh -o install.sh
4743
4844# Make the script executable
4945chmod +x install.sh
5046
5147# Run the installation script
52- # Pass version as argument if not latest
48+ # The official installer accepts version as an argument according to documentation:
49+ # curl -fsSL https://claude.ai/install.sh | bash -s latest
50+ # curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58
5351if [ " $CLAUDE_VERSION " = " latest" ]; then
5452 echo " Installing latest version of Claude Code..."
55- bash install.sh
53+ bash install.sh || {
54+ echo " Warning: Installation script failed. This may be expected if the official installer doesn't support unattended installation."
55+ exit 1
56+ }
5657else
5758 echo " Installing Claude Code version $CLAUDE_VERSION ..."
58- bash install.sh " $CLAUDE_VERSION "
59+ bash install.sh " $CLAUDE_VERSION " || {
60+ echo " Warning: Installation script with version argument failed."
61+ echo " Retrying without version argument..."
62+ bash install.sh || {
63+ echo " Warning: Installation script failed. This may be expected if the official installer doesn't support unattended installation."
64+ exit 1
65+ }
66+ }
5967fi
6068
6169# Clean up
0 commit comments