Skip to content

Commit

Permalink
Merge pull request #4 from vmware-labs/install-plugin
Browse files Browse the repository at this point in the history
Modify Installation script for Helm plugin
  • Loading branch information
mpermar authored Aug 22, 2023
2 parents e7b1baf + 4487076 commit 2fb16a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions install-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PROJECT_NAME="distribution-tooling-for-helm"
PROJECT_PLUGIN_SHORTNAME="helm-dt"
BINARY_NAME="dt"
PROJECT_GH="vmware-labs/$PROJECT_NAME"
PLUGIN_MANIFEST="plugin.yaml"

# Convert HELM_BIN and HELM_PLUGIN_DIR to unix if cygpath is
# available. This is the case when using MSYS2 or Cygwin
Expand All @@ -21,8 +22,6 @@ fi

mkdir -p "$HELM_HOME"

: "${HELM_PLUGIN_DIR:="$HELM_HOME/plugins/$PROJECT_PLUGIN_SHORTNAME"}"

if [ "$SKIP_BIN_INSTALL" = "1" ]; then
echo "Skipping binary install"
exit
Expand Down Expand Up @@ -84,7 +83,7 @@ verifySupported() {

# getDownloadURL checks the latest available version.
getDownloadURL() {
version="$(cat $HELM_PLUGIN_DIR/plugin.yaml | grep "version" | cut -d '"' -f 2)"
version="$(cat $HELM_PLUGIN_DIR/$PLUGIN_MANIFEST | grep "version" | cut -d '"' -f 2)"
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"
else
Expand Down Expand Up @@ -122,7 +121,7 @@ downloadFile() {
# installs it.
installFile() {
tar xzf "$PLUGIN_TMP_FILE" -C "$HELM_TMP"
HELM_TMP_BIN="$HELM_TMP/$PROJECT_NAME/$BINARY_NAME"
HELM_TMP_BIN="$HELM_TMP/$BINARY_NAME"
if [ "${OS}" = "windows" ]; then
HELM_TMP_BIN="$HELM_TMP_BIN.exe"
fi
Expand All @@ -145,7 +144,7 @@ exit_trap() {
# testVersion tests the installed client to make sure it is working.
testVersion() {
set +e
echo "$PROJECT_NAME installed into $HELM_PLUGIN_DIR/$PROJECT_NAME"
echo "$PROJECT_NAME installed into $HELM_PLUGIN_DIR"
"${HELM_PLUGIN_DIR}/bin/$BINARY_NAME" -h
set -e
}
Expand Down

0 comments on commit 2fb16a6

Please sign in to comment.