mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Merge pull request #3023 from TIKI-Institut/master
Enable the installation of specific versions with the "install_kustomize.sh" script (#3022)
This commit is contained in:
@@ -1,10 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Downloads the most recently released kustomize binary
|
# If no argument is given -> Downloads the most recently released
|
||||||
# to your current working directory.
|
# kustomize binary to your current working directory.
|
||||||
|
# (e.g. 'install_kustomize.sh')
|
||||||
|
#
|
||||||
|
# If an argument is given -> Downloads the specified version of the
|
||||||
|
# kustomize binary to your current working directory.
|
||||||
|
# (e.g. 'install_kustomize.sh 3.8.2')
|
||||||
#
|
#
|
||||||
# Fails if the file already exists.
|
# Fails if the file already exists.
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
version=""
|
||||||
|
else
|
||||||
|
version=$1
|
||||||
|
fi
|
||||||
|
|
||||||
where=$PWD
|
where=$PWD
|
||||||
if [ -f $where/kustomize ]; then
|
if [ -f $where/kustomize ]; then
|
||||||
echo "A file named kustomize already exists (remove it first)."
|
echo "A file named kustomize already exists (remove it first)."
|
||||||
@@ -17,7 +28,7 @@ if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function cleanup {
|
function cleanup {
|
||||||
rm -rf "$tmpDir"
|
rm -rf "$tmpDir"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,11 +47,16 @@ curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases |\
|
|||||||
grep browser_download |\
|
grep browser_download |\
|
||||||
grep $opsys |\
|
grep $opsys |\
|
||||||
cut -d '"' -f 4 |\
|
cut -d '"' -f 4 |\
|
||||||
grep /kustomize/v |\
|
grep /kustomize/v$version |\
|
||||||
sort | tail -n 1 |\
|
sort | tail -n 1 |\
|
||||||
xargs curl -s -O -L
|
xargs curl -s -O -L
|
||||||
|
|
||||||
tar xzf ./kustomize_v*_${opsys}_amd64.tar.gz
|
if [ -e ./kustomize_v*_${opsys}_amd64.tar.gz ]; then
|
||||||
|
tar xzf ./kustomize_v*_${opsys}_amd64.tar.gz
|
||||||
|
else
|
||||||
|
echo "Error: kustomize binary with the version $version does not exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cp ./kustomize $where
|
cp ./kustomize $where
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user