From c8b4af02304f598aa74858de768dfd787d50a6fc Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Fri, 12 Dec 2025 15:00:46 -0500 Subject: [PATCH] Allow specifying a version for the install script --- README.md | 2 ++ install.sh | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bdf404e..085f8837 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,8 @@ Use `| sudo bash` to run as root and install to `/usr/local/bin`. Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` when run as root or `$HOME/.local` when run as a non-root user. +Set `VERSION` to install a specific version. Defaults to the latest version. + ### Launching the CLI ```bash diff --git a/install.sh b/install.sh index 39f069fa..c6632e0a 100755 --- a/install.sh +++ b/install.sh @@ -34,7 +34,17 @@ case "$(uname -m)" in *) echo "Error: Unsupported architecture $(uname -m)" >&2 ; exit 1 ;; esac -DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz" +# Determine download URL based on VERSION +if [ -n "$VERSION" ]; then + # Prefix version with 'v' if not already present + case "$VERSION" in + v*) ;; + *) VERSION="v$VERSION" ;; + esac + DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/copilot-${PLATFORM}-${ARCH}.tar.gz" +else + DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz" +fi echo "Downloading from: $DOWNLOAD_URL" # Download and extract with error handling