Skip to content

Commit

Permalink
Merge pull request #241 from jouve/clean-dl
Browse files Browse the repository at this point in the history
cleanup downloaded archive after install
  • Loading branch information
hypnoglow authored Oct 29, 2023
2 parents ee8f6fb + e9e5382 commit 79fc0fe
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hack/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ on_exit() {
if [ ${exit_code} -ne 0 ]; then
echo "${PROJECT_NAME} install hook failed. Please remove the plugin using 'helm plugin remove s3' and install again." > /dev/stderr
fi
rm -rf "releases"
exit ${exit_code}
}
trap on_exit EXIT

version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
version="$(grep "version" plugin.yaml | cut -d '"' -f 2)"
echo "Downloading and installing ${PROJECT_NAME} v${version} ..."

initArch
Expand All @@ -64,8 +65,7 @@ initOS
binary_url="https://github.com/${PROJECT_GH}/releases/download/v${version}/${PROJECT_NAME}_${version}_${os}_${arch}.tar.gz"
checksum_url="https://github.com/${PROJECT_GH}/releases/download/v${version}/${PROJECT_NAME}_${version}_checksums.txt"

mkdir -p "bin"
mkdir -p "releases/v${version}"
mkdir "releases"
binary_filename="releases/v${version}.tar.gz"
checksums_filename="releases/v${version}_checksums.txt"

Expand Down Expand Up @@ -96,6 +96,4 @@ checksums_filename="releases/v${version}_checksums.txt"
)

# Unpack the binary.
tar xzf "${binary_filename}" -C "releases/v${version}"
mv "releases/v${version}/bin/${PROJECT_NAME}" "bin/${PROJECT_NAME}"
exit 0
tar xzf "${binary_filename}" bin/helm-s3

0 comments on commit 79fc0fe

Please sign in to comment.