From 2b3607a33d8c433635f17448929b3a9f58bb5029 Mon Sep 17 00:00:00 2001 From: John Blischak Date: Tue, 12 Mar 2024 13:46:32 -0400 Subject: [PATCH] fix: install Windows executable with `install.sh` in Git Bash (#966) --- install/install.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/install/install.sh b/install/install.sh index 027083d98..64abd09c9 100644 --- a/install/install.sh +++ b/install/install.sh @@ -15,6 +15,8 @@ if [[ $PLATFORM == "Darwin" ]]; then PLATFORM="apple-darwin" elif [[ $PLATFORM == "Linux" ]]; then PLATFORM="unknown-linux-musl" +elif [[ $(uname -o) == "Msys" ]]; then + PLATFORM="pc-windows-msvc" fi if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then @@ -24,11 +26,15 @@ fi BINARY="pixi-${ARCH}-${PLATFORM}" +EXTENSION="tar.gz" +if [[ $(uname -o) == "Msys" ]]; then + EXTENSION="zip" +fi if [[ $VERSION == "latest" ]]; then - DOWNLOAD_URL=https://github.com/${REPO}/releases/latest/download/${BINARY}.tar.gz + DOWNLOAD_URL=https://github.com/${REPO}/releases/latest/download/${BINARY}.${EXTENSION} else - DOWNLOAD_URL=https://github.com/${REPO}/releases/download/${VERSION}/${BINARY}.tar.gz + DOWNLOAD_URL=https://github.com/${REPO}/releases/download/${VERSION}/${BINARY}.${EXTENSION} fi printf "This script will automatically download and install Pixi (${VERSION}) for you.\nGetting it from this url: $DOWNLOAD_URL\n" @@ -71,10 +77,15 @@ if [[ ! -s $TEMP_FILE ]]; then exit 1 fi -# Extract pixi from the downloaded tar file +# Extract pixi from the downloaded file mkdir -p "$BIN_DIR" -tar -xzf "$TEMP_FILE" -C "$BIN_DIR" -chmod +x "$BIN_DIR/pixi" +if [[ $(uname -o) == "Msys" ]]; then + unzip "$TEMP_FILE" -d "$BIN_DIR" +else + tar -xzf "$TEMP_FILE" -C "$BIN_DIR" + chmod +x "$BIN_DIR/pixi" +fi + echo "The 'pixi' binary is installed into '${BIN_DIR}'" update_shell() {