Vernon Wee Hong KOH ha revisionato questo gist 3 months ago. Vai alla revisione
2 files changed, 9 insertions, 6 deletions
README.md
| @@ -44,7 +44,7 @@ Once the menu loads, simply **follow the interactive prompts**. You can select m | |||
| 44 | 44 | ||
| 45 | 45 | ### Cloud & App Platforms | |
| 46 | 46 | * **AWS CLI:** Fetches the official binaries directly from Amazon. | |
| 47 | - | * **Google Cloud CLI (gcloud):** Official Google setup script. | |
| 47 | + | * **Google Cloud CLI (gcloud):** Official Google setup script, installed at `/opt/google-cloud-sdk`. | |
| 48 | 48 | * **Firebase CLI:** Installs `firebase-tools` via NPM, so Node.js/NPM is required. | |
| 49 | 49 | ||
| 50 | 50 | ### Developer Productivity | |
menu.sh
| @@ -500,14 +500,17 @@ install_aws() { | |||
| 500 | 500 | } | |
| 501 | 501 | ||
| 502 | 502 | install_gcloud() { | |
| 503 | - | if require_cmd gcloud; then warn "Google Cloud CLI exists"; return; fi | |
| 504 | - | log "Installing Google Cloud CLI..." | |
| 505 | - | curl -fsSL https://sdk.cloud.google.com | $CURRENT_SHELL -s -- --disable-prompts | |
| 503 | + | local gcloud_dir="/opt/google-cloud-sdk" | |
| 504 | + | ||
| 505 | + | if [[ -x "$gcloud_dir/bin/gcloud" ]]; then warn "Google Cloud CLI exists at $gcloud_dir"; return; fi | |
| 506 | + | log "Installing Google Cloud CLI to $gcloud_dir..." | |
| 507 | + | curl -fsSL https://sdk.cloud.google.com | sudo bash -s -- --disable-prompts --install-dir=/opt | |
| 508 | + | sudo chown -R "$(id -u):$(id -g)" "$gcloud_dir" | |
| 506 | 509 | ||
| 507 | 510 | if [[ "$CURRENT_SHELL" == "zsh" ]]; then | |
| 508 | - | add_to_path_config "GCLOUD" '[ -f "$HOME/google-cloud-sdk/path.zsh.inc" ] && source "$HOME/google-cloud-sdk/path.zsh.inc"' | |
| 511 | + | add_to_path_config "GCLOUD" '[ -f "/opt/google-cloud-sdk/path.zsh.inc" ] && source "/opt/google-cloud-sdk/path.zsh.inc"' | |
| 509 | 512 | else | |
| 510 | - | add_to_path_config "GCLOUD" '[ -f "$HOME/google-cloud-sdk/path.bash.inc" ] && source "$HOME/google-cloud-sdk/path.bash.inc"' | |
| 513 | + | add_to_path_config "GCLOUD" '[ -f "/opt/google-cloud-sdk/path.bash.inc" ] && source "/opt/google-cloud-sdk/path.bash.inc"' | |
| 511 | 514 | fi | |
| 512 | 515 | } | |
| 513 | 516 | ||
Vernon Wee Hong KOH ha revisionato questo gist 3 months ago. Vai alla revisione
2 files changed, 5 insertions
README.md
| @@ -56,6 +56,7 @@ Once the menu loads, simply **follow the interactive prompts**. You can select m | |||
| 56 | 56 | ### AI & Agentic Tools | |
| 57 | 57 | * **Claude Code CLI:** Anthropic's official agent. | |
| 58 | 58 | * **OpenAI Codex CLI:** Required NVM/Node.js to run. | |
| 59 | + | * **OpenCode:** AI agent orchestration installed from the official OpenCode installer. | |
| 59 | 60 | ||
| 60 | 61 | ## ⚠️ Important Notes & Troubleshooting | |
| 61 | 62 | ||
menu.sh
| @@ -557,6 +557,8 @@ install_infisical() { | |||
| 557 | 557 | ||
| 558 | 558 | install_claude() { log "Installing Claude Code..."; curl -fsSL https://claude.ai/install.sh | $CURRENT_SHELL; } | |
| 559 | 559 | ||
| 560 | + | install_opencode() { log "Installing OpenCode..."; curl -fsSL https://opencode.ai/install | $CURRENT_SHELL; } | |
| 561 | + | ||
| 560 | 562 | install_codex() { | |
| 561 | 563 | log "Installing @openai/codex..." | |
| 562 | 564 | if ! require_cmd npm; then err "Node.js/NPM is required. Install NVM (3) first."; return 1; fi | |
| @@ -596,6 +598,7 @@ show_menu() { | |||
| 596 | 598 | printf "${YELLOW}--- AI & Agentic Tools ---${NC}\n" | |
| 597 | 599 | printf " 16) Claude Code CLI\n" | |
| 598 | 600 | printf " 17) OpenAI Codex CLI\n" | |
| 601 | + | printf " 18) OpenCode\n" | |
| 599 | 602 | printf "${BLUE}==================================================${NC}\n" | |
| 600 | 603 | printf " 99) Quit & Refresh Shell\n" | |
| 601 | 604 | printf "${BLUE}==================================================${NC}\n" | |
| @@ -628,6 +631,7 @@ while true; do | |||
| 628 | 631 | 15) install_infisical ;; | |
| 629 | 632 | 16) install_claude ;; | |
| 630 | 633 | 17) install_codex ;; | |
| 634 | + | 18) install_opencode ;; | |
| 631 | 635 | 99) | |
| 632 | 636 | log "Installation complete! Refreshing terminal environment..." | |
| 633 | 637 | ||
Vernon Wee Hong KOH ha revisionato questo gist 3 months ago. Vai alla revisione
2 files changed, 34 insertions, 21 deletions
README.md
| @@ -24,25 +24,34 @@ Once the menu loads, simply **follow the interactive prompts**. You can select m | |||
| 24 | 24 | ||
| 25 | 25 | ## 🛠️ Included Tools | |
| 26 | 26 | ||
| 27 | - | ### Core Runtimes & Managers | |
| 27 | + | ### Essentials & Package Managers | |
| 28 | 28 | * **Build Tools:** GCC, Make, Git, Curl, Unzip, and core libraries. | |
| 29 | 29 | * **Homebrew:** (Optional) Installed officially. | |
| 30 | + | ||
| 31 | + | ### Languages & Runtimes | |
| 30 | 32 | * **NVM (Node Version Manager):** Includes interactive prompt to install LTS or Latest Node.js immediately. | |
| 31 | 33 | * **Python 3:** Fetches the latest stable `.pkg` for Mac or compiles strictly from source for Linux. | |
| 32 | 34 | * **Go:** Fetches the latest tarball and installs system-wide to `/usr/local/go`. | |
| 33 | 35 | * **SDKMAN:** For managing Java, Kotlin, and Gradle. | |
| 34 | 36 | * **.NET:** Installed via Microsoft's official script. | |
| 35 | 37 | ||
| 36 | - | ### Cloud & Infrastructure | |
| 38 | + | ### Mobile Development | |
| 39 | + | * **Android SDK:** Installs command-line tools, platform tools, emulator, and current Android platform/build tools. | |
| 40 | + | ||
| 41 | + | ### Containers & Infrastructure | |
| 37 | 42 | * **Docker:** Downloads the official `.dmg` (macOS) or runs the official `get.docker.com` script (Linux) with auto-group assignment. | |
| 43 | + | * **Portainer:** Deploys Portainer CE as a Docker container with persistent storage. | |
| 44 | + | ||
| 45 | + | ### Cloud & App Platforms | |
| 38 | 46 | * **AWS CLI:** Fetches the official binaries directly from Amazon. | |
| 39 | 47 | * **Google Cloud CLI (gcloud):** Official Google setup script. | |
| 40 | - | * **Firebase CLI:** Standalone binary (no Node.js required natively). | |
| 41 | - | * **Portainer:** Deploys Portainer CE as a Docker container with persistent storage. | |
| 48 | + | * **Firebase CLI:** Installs `firebase-tools` via NPM, so Node.js/NPM is required. | |
| 42 | 49 | ||
| 43 | - | ### Dev Tools & Security | |
| 50 | + | ### Developer Productivity | |
| 44 | 51 | * **GitHub CLI (gh):** Downloaded directly from GitHub Releases to `/usr/local/bin`. | |
| 45 | - | * **Infisical CLI:** Downloaded directly from GitHub Releases for secret management. | |
| 52 | + | ||
| 53 | + | ### Secrets & Security | |
| 54 | + | * **Infisical CLI:** Installs `@infisical/cli` via NPM for secret management, so Node.js/NPM is required. | |
| 46 | 55 | ||
| 47 | 56 | ### AI & Agentic Tools | |
| 48 | 57 | * **Claude Code CLI:** Anthropic's official agent. | |
menu.sh
| @@ -571,24 +571,28 @@ show_menu() { | |||
| 571 | 571 | printf "${BLUE}==================================================${NC}\n" | |
| 572 | 572 | printf "${GREEN} DEVELOPER ENVIRONMENT INSTALLER (Polyglot) ${NC}\n" | |
| 573 | 573 | printf "${BLUE}==================================================${NC}\n" | |
| 574 | - | printf "${YELLOW}--- Core Runtimes & Managers ---${NC}\n" | |
| 575 | - | printf " 1) Build Tools (GCC/Make)\n" | |
| 574 | + | printf "${YELLOW}--- Essentials & Package Managers ---${NC}\n" | |
| 575 | + | printf " 1) Build Tools (GCC/Make/Git/Curl/Unzip)\n" | |
| 576 | 576 | printf " 2) Homebrew (Optional)\n" | |
| 577 | - | printf " 3) NVM (Node.js)\n" | |
| 578 | - | printf " 4) Python 3 (Official API)\n" | |
| 579 | - | printf " 5) Go (Official -> /usr/local)\n" | |
| 580 | - | printf " 6) SDKMAN (Java/Kotlin)\n" | |
| 581 | - | printf " 7) .NET (Official Script)\n" | |
| 577 | + | printf "${YELLOW}--- Languages & Runtimes ---${NC}\n" | |
| 578 | + | printf " 3) NVM + Node.js\n" | |
| 579 | + | printf " 4) Python 3\n" | |
| 580 | + | printf " 5) Go\n" | |
| 581 | + | printf " 6) SDKMAN (Java/Kotlin/Gradle)\n" | |
| 582 | + | printf " 7) .NET\n" | |
| 583 | + | printf "${YELLOW}--- Mobile Development ---${NC}\n" | |
| 582 | 584 | printf " 8) Android SDK (CLI + Platform Tools)\n" | |
| 583 | - | printf "${YELLOW}--- Cloud & Infrastructure ---${NC}\n" | |
| 584 | - | printf " 9) Docker (Official DMG/sh)\n" | |
| 585 | - | printf " 10) AWS CLI (Official Bin)\n" | |
| 586 | - | printf " 11) Google Cloud CLI (gcloud)\n" | |
| 587 | - | printf " 12) Firebase CLI (NPM/ARM64 Safe)\n" | |
| 585 | + | printf "${YELLOW}--- Containers & Infrastructure ---${NC}\n" | |
| 586 | + | printf " 9) Docker\n" | |
| 588 | 587 | printf " 13) Portainer (Docker UI)\n" | |
| 589 | - | printf "${YELLOW}--- Dev Tools & Security ---${NC}\n" | |
| 590 | - | printf " 14) GitHub CLI (Official Bin)\n" | |
| 591 | - | printf " 15) Infisical (Official Bin)\n" | |
| 588 | + | printf "${YELLOW}--- Cloud & App Platforms ---${NC}\n" | |
| 589 | + | printf " 10) AWS CLI\n" | |
| 590 | + | printf " 11) Google Cloud CLI (gcloud)\n" | |
| 591 | + | printf " 12) Firebase CLI\n" | |
| 592 | + | printf "${YELLOW}--- Developer Productivity ---${NC}\n" | |
| 593 | + | printf " 14) GitHub CLI\n" | |
| 594 | + | printf "${YELLOW}--- Secrets & Security ---${NC}\n" | |
| 595 | + | printf " 15) Infisical CLI\n" | |
| 592 | 596 | printf "${YELLOW}--- AI & Agentic Tools ---${NC}\n" | |
| 593 | 597 | printf " 16) Claude Code CLI\n" | |
| 594 | 598 | printf " 17) OpenAI Codex CLI\n" | |
Vernon Wee Hong KOH ha revisionato questo gist 3 months ago. Vai alla revisione
2 files changed, 2 insertions, 6 deletions
README.md
| @@ -46,7 +46,6 @@ Once the menu loads, simply **follow the interactive prompts**. You can select m | |||
| 46 | 46 | ||
| 47 | 47 | ### AI & Agentic Tools | |
| 48 | 48 | * **Claude Code CLI:** Anthropic's official agent. | |
| 49 | - | * **OpenCode:** AI agent orchestration. | |
| 50 | 49 | * **OpenAI Codex CLI:** Required NVM/Node.js to run. | |
| 51 | 50 | ||
| 52 | 51 | ## ⚠️ Important Notes & Troubleshooting | |
menu.sh
| @@ -556,7 +556,6 @@ install_infisical() { | |||
| 556 | 556 | # ======================================================= | |
| 557 | 557 | ||
| 558 | 558 | install_claude() { log "Installing Claude Code..."; curl -fsSL https://claude.ai/install.sh | $CURRENT_SHELL; } | |
| 559 | - | install_opencode() { log "Installing OpenCode..."; curl -fsSL https://opencode.ai/install | $CURRENT_SHELL; } | |
| 560 | 559 | ||
| 561 | 560 | install_codex() { | |
| 562 | 561 | log "Installing @openai/codex..." | |
| @@ -592,8 +591,7 @@ show_menu() { | |||
| 592 | 591 | printf " 15) Infisical (Official Bin)\n" | |
| 593 | 592 | printf "${YELLOW}--- AI & Agentic Tools ---${NC}\n" | |
| 594 | 593 | printf " 16) Claude Code CLI\n" | |
| 595 | - | printf " 17) OpenCode (opencode.ai)\n" | |
| 596 | - | printf " 18) OpenAI Codex CLI\n" | |
| 594 | + | printf " 17) OpenAI Codex CLI\n" | |
| 597 | 595 | printf "${BLUE}==================================================${NC}\n" | |
| 598 | 596 | printf " 99) Quit & Refresh Shell\n" | |
| 599 | 597 | printf "${BLUE}==================================================${NC}\n" | |
| @@ -625,8 +623,7 @@ while true; do | |||
| 625 | 623 | 14) install_gh ;; | |
| 626 | 624 | 15) install_infisical ;; | |
| 627 | 625 | 16) install_claude ;; | |
| 628 | - | 17) install_opencode ;; | |
| 629 | - | 18) install_codex ;; | |
| 626 | + | 17) install_codex ;; | |
| 630 | 627 | 99) | |
| 631 | 628 | log "Installation complete! Refreshing terminal environment..." | |
| 632 | 629 | ||
Vernon Wee Hong KOH ha revisionato questo gist 3 months ago. Vai alla revisione
2 files changed, 57 insertions, 11 deletions
README.md
| @@ -38,6 +38,7 @@ Once the menu loads, simply **follow the interactive prompts**. You can select m | |||
| 38 | 38 | * **AWS CLI:** Fetches the official binaries directly from Amazon. | |
| 39 | 39 | * **Google Cloud CLI (gcloud):** Official Google setup script. | |
| 40 | 40 | * **Firebase CLI:** Standalone binary (no Node.js required natively). | |
| 41 | + | * **Portainer:** Deploys Portainer CE as a Docker container with persistent storage. | |
| 41 | 42 | ||
| 42 | 43 | ### Dev Tools & Security | |
| 43 | 44 | * **GitHub CLI (gh):** Downloaded directly from GitHub Releases to `/usr/local/bin`. | |
| @@ -55,4 +56,4 @@ Once the menu loads, simply **follow the interactive prompts**. You can select m | |||
| 55 | 56 | * **AWS CLI on Linux:** Ensure you install **Build Tools (Option 1)** first if you are on a fresh Linux install, as the AWS installer requires `unzip` to extract the payload. | |
| 56 | 57 | ||
| 57 | 58 | --- | |
| 58 | - | *Built for developers who want total control over their toolchain.* | |
| 59 | + | *Built for developers who want total control over their toolchain.* | |
menu.sh
| @@ -437,6 +437,49 @@ install_docker() { | |||
| 437 | 437 | fi | |
| 438 | 438 | } | |
| 439 | 439 | ||
| 440 | + | install_portainer() { | |
| 441 | + | log "Installing Portainer CE..." | |
| 442 | + | ||
| 443 | + | if ! require_cmd docker; then | |
| 444 | + | err "Docker is required. Please install Docker (Option 9) first." | |
| 445 | + | return 1 | |
| 446 | + | fi | |
| 447 | + | ||
| 448 | + | if ! docker info >/dev/null 2>&1; then | |
| 449 | + | err "Docker is installed but the daemon is not running. Start Docker, then retry Portainer." | |
| 450 | + | return 1 | |
| 451 | + | fi | |
| 452 | + | ||
| 453 | + | if docker ps -a --format '{{.Names}}' | grep -Fxq portainer; then | |
| 454 | + | warn "Portainer container already exists." | |
| 455 | + | if ! docker ps --format '{{.Names}}' | grep -Fxq portainer; then | |
| 456 | + | log "Starting existing Portainer container..." | |
| 457 | + | docker start portainer | |
| 458 | + | fi | |
| 459 | + | log "Portainer is available at https://localhost:9443" | |
| 460 | + | return 0 | |
| 461 | + | fi | |
| 462 | + | ||
| 463 | + | docker volume create portainer_data || { | |
| 464 | + | err "Failed to create the Portainer data volume." | |
| 465 | + | return 1 | |
| 466 | + | } | |
| 467 | + | ||
| 468 | + | if ! docker run -d \ | |
| 469 | + | -p 8000:8000 \ | |
| 470 | + | -p 9443:9443 \ | |
| 471 | + | --name portainer \ | |
| 472 | + | --restart=always \ | |
| 473 | + | -v /var/run/docker.sock:/var/run/docker.sock \ | |
| 474 | + | -v portainer_data:/data \ | |
| 475 | + | portainer/portainer-ce:sts; then | |
| 476 | + | err "Failed to start the Portainer container." | |
| 477 | + | return 1 | |
| 478 | + | fi | |
| 479 | + | ||
| 480 | + | log "Portainer is available at https://localhost:9443" | |
| 481 | + | } | |
| 482 | + | ||
| 440 | 483 | install_aws() { | |
| 441 | 484 | if require_cmd aws; then warn "AWS CLI exists"; return; fi | |
| 442 | 485 | log "Installing AWS CLI directly from Amazon..." | |
| @@ -543,13 +586,14 @@ show_menu() { | |||
| 543 | 586 | printf " 10) AWS CLI (Official Bin)\n" | |
| 544 | 587 | printf " 11) Google Cloud CLI (gcloud)\n" | |
| 545 | 588 | printf " 12) Firebase CLI (NPM/ARM64 Safe)\n" | |
| 589 | + | printf " 13) Portainer (Docker UI)\n" | |
| 546 | 590 | printf "${YELLOW}--- Dev Tools & Security ---${NC}\n" | |
| 547 | - | printf " 13) GitHub CLI (Official Bin)\n" | |
| 548 | - | printf " 14) Infisical (Official Bin)\n" | |
| 591 | + | printf " 14) GitHub CLI (Official Bin)\n" | |
| 592 | + | printf " 15) Infisical (Official Bin)\n" | |
| 549 | 593 | printf "${YELLOW}--- AI & Agentic Tools ---${NC}\n" | |
| 550 | - | printf " 15) Claude Code CLI\n" | |
| 551 | - | printf " 16) OpenCode (opencode.ai)\n" | |
| 552 | - | printf " 17) OpenAI Codex CLI\n" | |
| 594 | + | printf " 16) Claude Code CLI\n" | |
| 595 | + | printf " 17) OpenCode (opencode.ai)\n" | |
| 596 | + | printf " 18) OpenAI Codex CLI\n" | |
| 553 | 597 | printf "${BLUE}==================================================${NC}\n" | |
| 554 | 598 | printf " 99) Quit & Refresh Shell\n" | |
| 555 | 599 | printf "${BLUE}==================================================${NC}\n" | |
| @@ -577,11 +621,12 @@ while true; do | |||
| 577 | 621 | 10) install_aws ;; | |
| 578 | 622 | 11) install_gcloud ;; | |
| 579 | 623 | 12) install_firebase ;; | |
| 580 | - | 13) install_gh ;; | |
| 581 | - | 14) install_infisical ;; | |
| 582 | - | 15) install_claude ;; | |
| 583 | - | 16) install_opencode ;; | |
| 584 | - | 17) install_codex ;; | |
| 624 | + | 13) install_portainer ;; | |
| 625 | + | 14) install_gh ;; | |
| 626 | + | 15) install_infisical ;; | |
| 627 | + | 16) install_claude ;; | |
| 628 | + | 17) install_opencode ;; | |
| 629 | + | 18) install_codex ;; | |
| 585 | 630 | 99) | |
| 586 | 631 | log "Installation complete! Refreshing terminal environment..." | |
| 587 | 632 | ||
weehong ha revisionato questo gist 3 months ago. Vai alla revisione
1 file changed, 1 insertion, 1 deletion
README.md
| @@ -17,7 +17,7 @@ Unlike standard setup scripts that rely heavily on package managers like Homebre | |||
| 17 | 17 | You can launch the interactive installer directly from your terminal with a single command: | |
| 18 | 18 | ||
| 19 | 19 | ```bash | |
| 20 | - | bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/af1c64c143a44ffbb0a1632dd6a32af1/raw/HEAD/menu.sh)" | |
| 20 | + | bash -c "$(curl -fsSL https://tinyurl.com/4rskc9e7)" | |
| 21 | 21 | ``` | |
| 22 | 22 | ||
| 23 | 23 | Once the menu loads, simply **follow the interactive prompts**. You can select multiple tools at once by entering space-separated numbers (e.g., `1 3 8 12`). | |
weehong ha revisionato questo gist 3 months ago. Vai alla revisione
1 file changed, 6 insertions
menu.sh
| @@ -137,6 +137,9 @@ install_brew() { | |||
| 137 | 137 | } | |
| 138 | 138 | ||
| 139 | 139 | install_nvm() { | |
| 140 | + | # 1. Temporarily disable 'unbound variable' strictness for NVM | |
| 141 | + | set +u | |
| 142 | + | ||
| 140 | 143 | export NVM_DIR="$HOME/.nvm" | |
| 141 | 144 | ||
| 142 | 145 | if [ -d "$NVM_DIR" ]; then | |
| @@ -179,6 +182,9 @@ install_nvm() { | |||
| 179 | 182 | npm config set logs-max 0 | |
| 180 | 183 | ;; | |
| 181 | 184 | esac | |
| 185 | + | ||
| 186 | + | # 2. Re-enable 'unbound variable' strictness for the rest of your script | |
| 187 | + | set -u | |
| 182 | 188 | } | |
| 183 | 189 | ||
| 184 | 190 | install_python() { | |
weehong ha revisionato questo gist 3 months ago. Vai alla revisione
1 file changed, 1 insertion, 1 deletion
README.md
| @@ -17,7 +17,7 @@ Unlike standard setup scripts that rely heavily on package managers like Homebre | |||
| 17 | 17 | You can launch the interactive installer directly from your terminal with a single command: | |
| 18 | 18 | ||
| 19 | 19 | ```bash | |
| 20 | - | bash -c "$(curl -fsSL https://opengist.rmrf.online/weehong/af1c64c143a44ffbb0a1632dd6a32af1/raw/HEAD/menu.sh)" | |
| 20 | + | bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/af1c64c143a44ffbb0a1632dd6a32af1/raw/HEAD/menu.sh)" | |
| 21 | 21 | ``` | |
| 22 | 22 | ||
| 23 | 23 | Once the menu loads, simply **follow the interactive prompts**. You can select multiple tools at once by entering space-separated numbers (e.g., `1 3 8 12`). | |
Vernon Wee Hong KOH ha revisionato questo gist 4 months ago. Vai alla revisione
1 file changed, 39 insertions, 9 deletions
menu.sh
| @@ -184,35 +184,65 @@ install_nvm() { | |||
| 184 | 184 | install_python() { | |
| 185 | 185 | log "Fetching latest stable Python version..." | |
| 186 | 186 | ||
| 187 | - | LATEST_PY=$(curl -s https://www.python.org/downloads/ | grep -o 'Download Python 3\.[0-9]\{1,2\}\.[0-9]\{1,2\}' | head -1 | grep -o '3\.[0-9]\{1,2\}\.[0-9]\{1,2\}') | |
| 188 | - | [[ -z "$LATEST_PY" ]] && LATEST_PY="3.12.3" | |
| 187 | + | LATEST_PY=$( | |
| 188 | + | curl -fsSL --compressed https://www.python.org/downloads/ | | |
| 189 | + | sed -nE 's/.*Download Python ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' | | |
| 190 | + | head -1 | |
| 191 | + | ) | |
| 192 | + | ||
| 193 | + | if [[ -z "$LATEST_PY" ]]; then | |
| 194 | + | err "Could not detect the latest stable Python version from python.org." | |
| 195 | + | return 1 | |
| 196 | + | fi | |
| 189 | 197 | ||
| 190 | 198 | log "Detected Stable Version: $LATEST_PY" | |
| 191 | 199 | ||
| 192 | 200 | if [[ "$OS" == "macOS" ]]; then | |
| 193 | 201 | log "Downloading official macOS package..." | |
| 194 | 202 | PKG_URL="https://www.python.org/ftp/python/${LATEST_PY}/python-${LATEST_PY}-macos11.pkg" | |
| 195 | - | curl -fsSL -o /tmp/python.pkg "$PKG_URL" | |
| 203 | + | curl -fsSL --compressed -o /tmp/python.pkg "$PKG_URL" || { | |
| 204 | + | err "Failed to download Python macOS package from $PKG_URL" | |
| 205 | + | return 1 | |
| 206 | + | } | |
| 196 | 207 | ||
| 197 | 208 | log "Running installer..." | |
| 198 | - | sudo installer -pkg /tmp/python.pkg -target / | |
| 209 | + | sudo installer -pkg /tmp/python.pkg -target / || { | |
| 210 | + | err "Python macOS installer failed." | |
| 211 | + | rm -f /tmp/python.pkg | |
| 212 | + | return 1 | |
| 213 | + | } | |
| 199 | 214 | rm /tmp/python.pkg | |
| 200 | 215 | else | |
| 201 | 216 | log "Installing build dependencies (zlib, ssl, etc)..." | |
| 202 | - | sudo apt-get update && sudo apt-get install -y build-essential zlib1g-dev libssl-dev libffi-dev libsqlite3-dev | |
| 217 | + | sudo apt-get update && sudo apt-get install -y build-essential zlib1g-dev libssl-dev libffi-dev libsqlite3-dev || { | |
| 218 | + | err "Failed to install Python build dependencies." | |
| 219 | + | return 1 | |
| 220 | + | } | |
| 203 | 221 | ||
| 204 | 222 | SRC_URL="https://www.python.org/ftp/python/${LATEST_PY}/Python-${LATEST_PY}.tgz" | |
| 205 | 223 | ||
| 206 | 224 | log "Downloading $SRC_URL..." | |
| 207 | - | curl -fSL -o /tmp/Python.tgz "$SRC_URL" || err "Failed to download Python source from $SRC_URL" | |
| 225 | + | curl -fSL --compressed -o /tmp/Python.tgz "$SRC_URL" || { | |
| 226 | + | err "Failed to download Python source from $SRC_URL" | |
| 227 | + | return 1 | |
| 228 | + | } | |
| 208 | 229 | ||
| 209 | - | cd /tmp && tar -xzf Python.tgz && cd "Python-${LATEST_PY}" | |
| 230 | + | cd /tmp && tar -xzf Python.tgz && cd "Python-${LATEST_PY}" || { | |
| 231 | + | err "Failed to extract Python source archive." | |
| 232 | + | return 1 | |
| 233 | + | } | |
| 210 | 234 | ||
| 211 | 235 | log "Configuring build (with ensurepip)..." | |
| 212 | - | ./configure --enable-optimizations --with-ensurepip=install | |
| 236 | + | ./configure --enable-optimizations --with-ensurepip=install || { | |
| 237 | + | err "Python configure step failed." | |
| 238 | + | return 1 | |
| 239 | + | } | |
| 213 | 240 | ||
| 214 | 241 | log "Compiling Python (this may take a few minutes)..." | |
| 215 | - | sudo make altinstall | |
| 242 | + | sudo make altinstall || { | |
| 243 | + | err "Python build/install step failed." | |
| 244 | + | return 1 | |
| 245 | + | } | |
| 216 | 246 | ||
| 217 | 247 | PY_MINOR=$(echo "$LATEST_PY" | cut -d. -f1,2) | |
| 218 | 248 | ||
weehong ha revisionato questo gist 4 months ago. Vai alla revisione
Nessuna modifica