Skip to content

Commit

Permalink
Convert line endings back
Browse files Browse the repository at this point in the history
  • Loading branch information
undera committed Jan 16, 2023
1 parent 28a4b37 commit a91287c
Showing 1 changed file with 79 additions and 79 deletions.
158 changes: 79 additions & 79 deletions scripts/install_plugin.sh
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
#!/bin/sh -e

# Copied w/ love from the chartmuseum/helm-push :)

if [ -n "$HELM_DEBUG" ]; then
set -x
fi

name="helm-dashboard"
repo="https://github.com/komodorio/${name}"
api_repo="https://api.github.com/repos/komodorio/${name}/releases/latest"

if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then
echo "Development mode: not downloading versioned release."
exit 0
fi

version="$(curl -X GET ${api_repo} | grep '\"name\": "v.*\"' | cut -d 'v' -f 2 | cut -d '"' -f 1)"
echo Tried to autodetect latest version: $version
[ -z "$version" ] && {
version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo Defaulted to version: $version
}
echo "Downloading and installing ${name} v${version} ..."

url=""

# convert architecture of the target system to a compatible GOARCH value.
# Otherwise failes to download of the plugin from github, because the provided
# architecture by `uname -m` is not part of the github release.
arch=""
case $(uname -m) in
x86_64)
arch="x86_64"
;;
armv6*)
arch="armv6"
;;
# match every arm processor version like armv7h, armv7l and so on.
armv7*)
arch="armv7"
;;
aarch64 | arm64)
arch="arm64"
;;
*)
echo "Failed to detect target architecture"
exit 1
;;
esac


if [ "$(uname)" = "Darwin" ]; then
url="${repo}/releases/download/v${version}/${name}_${version}_Darwin_${arch}.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then
url="${repo}/releases/download/v${version}/${name}_${version}_Linux_${arch}.tar.gz"
else
url="${repo}/releases/download/v${version}/${name}_${version}_windows_${arch}.tar.gz"
fi

echo $url

mkdir -p "bin"
mkdir -p "releases/v${version}"

# Download with curl if possible.
if [ -x "$(which curl 2>/dev/null)" ]; then
curl --fail -sSL "${url}" -o "releases/v${version}.tar.gz"
else
wget -q "${url}" -O "releases/v${version}.tar.gz"
fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mv "releases/v${version}/${name}" "bin/${name}" || \
mv "releases/v${version}/${name}.exe" "bin/${name}"

echo
echo "Helm Dashboard is installed, to start it, run in your terminal:"
echo " helm dashboard"
echo
#!/bin/sh -e

# Copied w/ love from the chartmuseum/helm-push :)

if [ -n "$HELM_DEBUG" ]; then
set -x
fi

name="helm-dashboard"
repo="https://github.com/komodorio/${name}"
api_repo="https://api.github.com/repos/komodorio/${name}/releases/latest"

if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then
echo "Development mode: not downloading versioned release."
exit 0
fi

version="$(curl -X GET ${api_repo} | grep '\"name\": "v.*\"' | cut -d 'v' -f 2 | cut -d '"' -f 1)"
echo Tried to autodetect latest version: $version
[ -z "$version" ] && {
version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo Defaulted to version: $version
}
echo "Downloading and installing ${name} v${version} ..."

url=""

# convert architecture of the target system to a compatible GOARCH value.
# Otherwise failes to download of the plugin from github, because the provided
# architecture by `uname -m` is not part of the github release.
arch=""
case $(uname -m) in
x86_64)
arch="x86_64"
;;
armv6*)
arch="armv6"
;;
# match every arm processor version like armv7h, armv7l and so on.
armv7*)
arch="armv7"
;;
aarch64 | arm64)
arch="arm64"
;;
*)
echo "Failed to detect target architecture"
exit 1
;;
esac


if [ "$(uname)" = "Darwin" ]; then
url="${repo}/releases/download/v${version}/${name}_${version}_Darwin_${arch}.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then
url="${repo}/releases/download/v${version}/${name}_${version}_Linux_${arch}.tar.gz"
else
url="${repo}/releases/download/v${version}/${name}_${version}_windows_${arch}.tar.gz"
fi

echo $url

mkdir -p "bin"
mkdir -p "releases/v${version}"

# Download with curl if possible.
if [ -x "$(which curl 2>/dev/null)" ]; then
curl --fail -sSL "${url}" -o "releases/v${version}.tar.gz"
else
wget -q "${url}" -O "releases/v${version}.tar.gz"
fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mv "releases/v${version}/${name}" "bin/${name}" || \
mv "releases/v${version}/${name}.exe" "bin/${name}"

echo
echo "Helm Dashboard is installed, to start it, run in your terminal:"
echo " helm dashboard"
echo

0 comments on commit a91287c

Please sign in to comment.