Skip to content

Commit

Permalink
Merge pull request #36 from vmware-labs/windows-install-zip
Browse files Browse the repository at this point in the history
Use zipfile when installing in Windows
  • Loading branch information
alemorcuq authored Jan 15, 2024
2 parents 597660d + afa5c2d commit 5017ab1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Provided you have [Helm](https://helm.sh) then you can install this tool as a pl
$ helm plugin install https://github.com/vmware-labs/distribution-tooling-for-helm
```

> **Note:** Windows installation
>
> If installing on Windows, the above command must be run in a bash emulator such as Git Bash.
### Downloading and using standalone

Fetch the latest available release from the [Releases](https://github.com/vmware-labs/distribution-tooling-for-helm/releases) section.
Expand Down
12 changes: 9 additions & 3 deletions install-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ verifySupported() {
# getDownloadURL checks the latest available version.
getDownloadURL() {
version="$(< "$HELM_PLUGIN_DIR/$PLUGIN_MANIFEST" grep "version" | cut -d '"' -f 2)"
ext="tar.gz"
if [ "$OS" = "windows" ]; then
ext="zip"
fi
if [ "$SCRIPT_MODE" = "install" ] && [ -n "$version" ]; then
DOWNLOAD_URL="https://github.com/${PROJECT_GH}/releases/download/v${version}/${PROJECT_NAME}_${version}_${OS}_${ARCH}.tar.gz"
DOWNLOAD_URL="https://github.com/${PROJECT_GH}/releases/download/v${version}/${PROJECT_NAME}_${version}_${OS}_${ARCH}.${ext}"
else
DOWNLOAD_URL="https://github.com/${PROJECT_GH}/releases/latest/download/${PROJECT_NAME}_${version}_${OS}_${ARCH}.tar.gz"
DOWNLOAD_URL="https://github.com/${PROJECT_GH}/releases/latest/download/${PROJECT_NAME}_${version}_${OS}_${ARCH}.${ext}"
fi
}

Expand Down Expand Up @@ -119,10 +123,12 @@ downloadFile() {
# installFile verifies the SHA256 for the file, then unpacks and
# installs it.
installFile() {
tar xzf "$PLUGIN_TMP_FILE" -C "$HELM_TMP"
HELM_TMP_BIN="$HELM_TMP/$BINARY_NAME"
if [ "${OS}" = "windows" ]; then
HELM_TMP_BIN="$HELM_TMP_BIN.exe"
unzip "$PLUGIN_TMP_FILE" -d "$HELM_TMP"
else
tar xzf "$PLUGIN_TMP_FILE" -C "$HELM_TMP"
fi
echo "Preparing to install into ${HELM_PLUGIN_DIR}"
mkdir -p "$HELM_PLUGIN_DIR/bin"
Expand Down

0 comments on commit 5017ab1

Please sign in to comment.