Skip to content

Commit

Permalink
cleanup downloaded archive after install
Browse files Browse the repository at this point in the history
  • Loading branch information
jouve committed Oct 29, 2023
1 parent ee8f6fb commit e9e5382
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hack/install.sh
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 e9e5382

Please sign in to comment.