diff --git a/README.md b/README.md index 4d83d8cd8..16ff4fcc5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # Upsun CLI +> [!IMPORTANT] +> **This repository has been migrated to [upsun/cli](https://github.com/upsun/cli).** +> +> Please use the new repository for all future installations, updates, and issue reporting. +> +> To install the CLI from the new location: +> ```console +> curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | bash +> ``` +> +> Existing installations will continue to work, but we recommend migrating to the new repository. + The **Upsun CLI** is the official command-line interface for [Upsun](https://upsun.com) (formerly Platform.sh). This repository hosts the source code and releases of the CLI. @@ -30,7 +42,7 @@ scoop install platform Use the bash installer for an automated installation, using the most preferable way for your system. ```console -curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash +curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | bash ``` The installer is configurable using the following environment variables: @@ -56,19 +68,19 @@ nix profile install nixpkgs#upsun
Force the CLI to be installed using the raw method - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | INSTALL_METHOD=raw bash + curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | INSTALL_METHOD=raw bash
Install a specific version - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | VERSION=4.0.1 bash + curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | VERSION=4.0.1 bash
Install the CLI in a user owned directory - curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | INSTALL_METHOD=raw INSTALL_DIR=$HOME/.local/bin bash + curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | INSTALL_METHOD=raw INSTALL_DIR=$HOME/.local/bin bash
### Alpine @@ -139,7 +151,7 @@ yum install -y platformsh-cli ### Manual installation -For manual installation, you can also [download the latest binaries](https://github.com/platformsh/cli/releases/latest). +For manual installation, you can also [download the latest binaries](https://github.com/upsun/cli/releases/latest). ## Upgrade @@ -160,7 +172,7 @@ scoop update platform ### Bash installer ```console -curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash +curl -fsSL https://raw.githubusercontent.com/upsun/cli/main/installer.sh | bash ``` ### Alpine diff --git a/installer.sh b/installer.sh index 288408a57..9b8bcb545 100644 --- a/installer.sh +++ b/installer.sh @@ -9,7 +9,7 @@ set -euo pipefail # Define this to force install method : "${INSTALL_METHOD:=}" -: "${URL:=https://github.com/platformsh/cli/releases/download}" +: "${URL:=https://github.com/upsun/cli/releases/download}" # Force Upsun CLI installation in this directory instead of system directory : "${INSTALL_DIR:=}" @@ -32,6 +32,12 @@ set -euo pipefail : "${BUILD_NUMBER:=}" : "${RUN_ID:=}" +# Skip migration prompt (set to any value to skip) +: "${SKIP_MIGRATION_PROMPT:=}" + +# New repository URL +NEW_REPO_INSTALLER="https://raw.githubusercontent.com/upsun/cli/main/installer.sh" + # global variables binary="platform" vendor_name="Upsun (formerly Platform.sh)" @@ -164,11 +170,70 @@ function exit_with_error() { exit 1 } +function output_stderr { + builtin echo -e "$1" >&2 +} + +function show_migration_warning { + output_stderr "" + output_stderr "\033[33m+-------------------------------------------------------------------------------------+\033[0m" + output_stderr "\033[33m| |\033[0m" + output_stderr "\033[33m| WARNING: This repository (platformsh/cli) has been migrated to upsun/cli |\033[0m" + output_stderr "\033[33m| |\033[0m" + output_stderr "\033[33m| Please use the new installer: |\033[0m" + output_stderr "\033[33m| curl -fsSL $NEW_REPO_INSTALLER | bash |\033[0m" + output_stderr "\033[33m| |\033[0m" + output_stderr "\033[33m+-------------------------------------------------------------------------------------+\033[0m" + output_stderr "" +} + +function prompt_migration_continue { + # Skip prompt if flag is set + if [ ! -z "${SKIP_MIGRATION_PROMPT}" ]; then + return + fi + + # Skip prompt if running in CI + if is_ci; then + return + fi + + # Skip prompt if not running interactively + if ! is_interactive; then + return + fi + + # Read from /dev/tty to get input even when script is piped + read -r -p " Do you want to continue with this installer? [y/N] " response < /dev/tty + + case "$response" in + [yY][eE][sS]|[yY]) + output "" + output " Continuing with installation from platformsh/cli..." "info" + output "" + ;; + *) + output "" + output " Installation cancelled." "info" + output " To install from the new repository, run:" "info" + output " curl -fsSL ${NEW_REPO_INSTALLER} | bash" "info" + output "" + exit 0 + ;; + esac +} + function intro() { local title="$vendor_name CLI Installer" output "$(create_table "$title")" "heading" + # Always show migration warning to stderr + show_migration_warning + + # Prompt user to continue if interactive and not in CI + prompt_migration_continue + output "\nChecking environment" "heading" } @@ -219,13 +284,13 @@ function check_curl() { output " [*] cURL is installed" "success" if gh auth status >/dev/null 2>&1; then GITHUB_TOKEN="$(gh auth token)" - if ! github_curl https://api.github.com/repos/platformsh/cli/releases/latest >/dev/null 2>&1; then + if ! github_curl https://api.github.com/repos/upsun/cli/releases/latest >/dev/null 2>&1; then GITHUB_TOKEN="" else output " [*] Using GitHub auth from the gh CLI" "success" fi elif [ ! -z "${GITHUB_TOKEN}" ]; then - if ! github_curl https://api.github.com/repos/platformsh/cli/releases/latest >/dev/null 2>&1; then + if ! github_curl https://api.github.com/repos/upsun/cli/releases/latest >/dev/null 2>&1; then GITHUB_TOKEN="" else output " [*] Using GitHub auth from the GITHUB_TOKEN env variable" "success" @@ -249,7 +314,7 @@ function check_gzip() { function check_version() { if [ -z "${VERSION}" ]; then - version=$(curl -I https://github.com/platformsh/cli/releases/latest 2>/dev/null | awk -F/ -v RS='\r\n' '/platformsh.cli.releases.tag/ {printf "%s", $NF}') + version=$(curl -I https://github.com/upsun/cli/releases/latest 2>/dev/null | awk -F/ -v RS='\r\n' '/upsun.cli.releases.tag/ {printf "%s", $NF}') output " [*] No version specified, using latest ($version)" "success" else output " [*] Version ${VERSION} specified" "success" @@ -537,6 +602,15 @@ function is_ci { fi } +function is_interactive { + # Check if stdin is a terminal (TTY) + if [ -t 0 ]; then + return 0 + else + return 1 + fi +} + function install_raw() { # Start downloading the right version output "\nDownloading the $vendor_name CLI" "heading" diff --git a/internal/config/platformsh-cli.yaml b/internal/config/platformsh-cli.yaml index d7eaa9357..a4270c9d2 100644 --- a/internal/config/platformsh-cli.yaml +++ b/internal/config/platformsh-cli.yaml @@ -4,8 +4,8 @@ # # These are settings for the 'platform' command, which is available for backwards compatibility. wrapper: - homebrew_tap: platformsh/tap/platformsh-cli - github_repo: platformsh/cli + homebrew_tap: upsun/tap/platformsh-cli + github_repo: upsun/cli application: name: 'Upsun CLI (Platform.sh compatibility)' diff --git a/internal/config/upsun-cli.yaml b/internal/config/upsun-cli.yaml index c50db2dc8..7c43b37f7 100644 --- a/internal/config/upsun-cli.yaml +++ b/internal/config/upsun-cli.yaml @@ -4,8 +4,8 @@ # # See ../internal/config/schema.go for the required keys wrapper: - homebrew_tap: platformsh/tap/upsun-cli - github_repo: platformsh/cli + homebrew_tap: upsun/tap/upsun-cli + github_repo: upsun/cli application: name: "Upsun CLI"