diff --git a/install-binary.sh b/install-binary.sh index ce077365..66943cc5 100755 --- a/install-binary.sh +++ b/install-binary.sh @@ -6,6 +6,16 @@ PROJECT_NAME="helm-diff" PROJECT_GH="databus23/$PROJECT_NAME" export GREP_COLOR="never" +# Convert HELM_BIN and HELM_PLUGIN_DIR to unix if cygpath is +# available. This is the case when using MSYS2 or Cygwin +# on Windows where helm returns a Windows path but we +# need a Unix path + +if type cygpath >/dev/null 2>&1; then + HELM_BIN="$(cygpath -u "${HELM_BIN}")" + HELM_PLUGIN_DIR="$(cygpath -u "${HELM_PLUGIN_DIR}")" +fi + [ -z "$HELM_BIN" ] && HELM_BIN=$(which helm) HELM_MAJOR_VERSION=$("${HELM_BIN}" version --client --short | awk -F '.' '{print $1}') @@ -16,15 +26,6 @@ mkdir -p "$HELM_HOME" : ${HELM_PLUGIN_DIR:="$HELM_HOME/plugins/helm-diff"} -# Convert the HELM_PLUGIN_DIR to unix if cygpath is -# available. This is the case when using MSYS2 or Cygwin -# on Windows where helm returns a Windows path but we -# need a Unix path - -if type cygpath >/dev/null 2>&1; then - HELM_PLUGIN_DIR=$(cygpath -u $HELM_PLUGIN_DIR) -fi - if [ "$SKIP_BIN_INSTALL" = "1" ]; then echo "Skipping binary install" exit