-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_kustomize.sh
More file actions
executable file
·50 lines (38 loc) · 961 Bytes
/
install_kustomize.sh
File metadata and controls
executable file
·50 lines (38 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Downloads the most recently released kustomize binary
# to your current working directory.
#
# Fails if the file already exists.
where=$1
if [ -f $where/kustomize ]; then
echo "A file named kustomize already exists (remove it first)."
exit 1
fi
tmpDir=`mktemp -d`
if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
echo "Could not create temp dir."
exit 1
fi
function cleanup {
rm -rf "$tmpDir"
}
trap cleanup EXIT
pushd $tmpDir >& /dev/null
opsys=windows
if [[ "$OSTYPE" == linux* ]]; then
opsys=linux
elif [[ "$OSTYPE" == darwin* ]]; then
opsys=darwin
fi
echo "Downloading kustomize..."
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases |\
grep browser_download |\
grep $opsys |\
cut -d '"' -f 4 |\
grep /kustomize/v |\
sort | tail -n 1 |\
xargs curl -s -O -L
tar xzf ./kustomize_v*_${opsys}_amd64.tar.gz
sudo cp ./kustomize $where
popd >& /dev/null
echo kustomize installed to $where