Change install_script.sh line endings to \r\n

Relates to #188
This commit is contained in:
Andrei Pohilko
2023-01-16 09:58:08 +00:00
parent b76fbb130a
commit 35421ede58

146
scripts/install_plugin.sh Executable file → Normal file
View File

@@ -1,73 +1,73 @@
#!/bin/sh -e #!/bin/sh -e
# Copied w/ love from the chartmuseum/helm-push :) # Copied w/ love from the chartmuseum/helm-push :)
name="helm-dashboard" name="helm-dashboard"
repo="https://github.com/komodorio/${name}" repo="https://github.com/komodorio/${name}"
api_repo="https://api.github.com/repos/komodorio/${name}/releases/latest" api_repo="https://api.github.com/repos/komodorio/${name}/releases/latest"
if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then
echo "Development mode: not downloading versioned release." echo "Development mode: not downloading versioned release."
exit 0 exit 0
fi fi
version="$(curl -X GET --header \"Accept: application/json\" ${api_repo} | grep '\"name\": "v.*\"' | cut -d 'v' -f 2 | cut -d '"' -f 1)" version="$(curl -X GET --header \"Accept: application/json\" ${api_repo} | grep '\"name\": "v.*\"' | cut -d 'v' -f 2 | cut -d '"' -f 1)"
[ -z "$version" ] && { [ -z "$version" ] && {
version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)" version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
} }
echo "Downloading and installing ${name} v${version} ..." echo "Downloading and installing ${name} v${version} ..."
url="" url=""
# convert architecture of the target system to a compatible GOARCH value. # convert architecture of the target system to a compatible GOARCH value.
# Otherwise failes to download of the plugin from github, because the provided # Otherwise failes to download of the plugin from github, because the provided
# architecture by `uname -m` is not part of the github release. # architecture by `uname -m` is not part of the github release.
arch="" arch=""
case $(uname -m) in case $(uname -m) in
x86_64) x86_64)
arch="x86_64" arch="x86_64"
;; ;;
armv6*) armv6*)
arch="armv6" arch="armv6"
;; ;;
# match every arm processor version like armv7h, armv7l and so on. # match every arm processor version like armv7h, armv7l and so on.
armv7*) armv7*)
arch="armv7" arch="armv7"
;; ;;
aarch64 | arm64) aarch64 | arm64)
arch="arm64" arch="arm64"
;; ;;
*) *)
echo "Failed to detect target architecture" echo "Failed to detect target architecture"
exit 1 exit 1
;; ;;
esac esac
if [ "$(uname)" = "Darwin" ]; then if [ "$(uname)" = "Darwin" ]; then
url="${repo}/releases/download/v${version}/${name}_${version}_Darwin_${arch}.tar.gz" url="${repo}/releases/download/v${version}/${name}_${version}_Darwin_${arch}.tar.gz"
elif [ "$(uname)" = "Linux" ] ; then elif [ "$(uname)" = "Linux" ] ; then
url="${repo}/releases/download/v${version}/${name}_${version}_Linux_${arch}.tar.gz" url="${repo}/releases/download/v${version}/${name}_${version}_Linux_${arch}.tar.gz"
else else
url="${repo}/releases/download/v${version}/${name}_${version}_windows_${arch}.tar.gz" url="${repo}/releases/download/v${version}/${name}_${version}_windows_${arch}.tar.gz"
fi fi
echo $url echo $url
mkdir -p "bin" mkdir -p "bin"
mkdir -p "releases/v${version}" mkdir -p "releases/v${version}"
# Download with curl if possible. # Download with curl if possible.
if [ -x "$(which curl 2>/dev/null)" ]; then if [ -x "$(which curl 2>/dev/null)" ]; then
curl --fail -sSL "${url}" -o "releases/v${version}.tar.gz" curl --fail -sSL "${url}" -o "releases/v${version}.tar.gz"
else else
wget -q "${url}" -O "releases/v${version}.tar.gz" wget -q "${url}" -O "releases/v${version}.tar.gz"
fi fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}" tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mv "releases/v${version}/${name}" "bin/${name}" || \ mv "releases/v${version}/${name}" "bin/${name}" || \
mv "releases/v${version}/${name}.exe" "bin/${name}" mv "releases/v${version}/${name}.exe" "bin/${name}"
echo echo
echo "Helm Dashboard is installed, to start it, run in your terminal:" echo "Helm Dashboard is installed, to start it, run in your terminal:"
echo " helm dashboard" echo " helm dashboard"
echo echo