File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ #
4
+ # This file will be fetched as: curl -L https://git.io/getLatestKubebuilder | sh -
5
+ # so it should be pure bourne shell, not bash (and not reference other scripts)
6
+ #
7
+ # The script fetches the latest kubebuilder release candidate and untars it.
8
+ # It lets users to do curl -L https://git.io//getLatestKubebuilder | KUBEBUILDER_VERSION=1.0.5 sh -
9
+ # for instance to change the version fetched.
10
+
11
+ OS=" $( uname) "
12
+ if [ " x${OS} " = " xDarwin" ] ; then
13
+ OSEXT=" darwin"
14
+ else
15
+ OSEXT=" linux"
16
+ fi
17
+ ARCH=amd64
18
+
19
+ if [ " x${KUBEBUILDER_VERSION} " = " x" ] ; then
20
+ KUBEBUILDER_VERSION=$( curl -L -s https://api.github.com/repos/kubernetes-sigs/kubebuilder/releases/latest | \
21
+ grep tag_name | sed " s/ *\" tag_name\" : *\"\\ (.*\\ )\" ,*/\\ 1/" )
22
+ fi
23
+
24
+ KUBEBUILDER_VERSION=${KUBEBUILDER_VERSION# " v" }
25
+ KUBEBUILDER_VERSION_NAME=" kubebuilder_${KUBEBUILDER_VERSION} "
26
+ URL=" https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION} /${KUBEBUILDER_VERSION_NAME} _${OSEXT} _${ARCH} .tar.gz"
27
+ echo " Downloading ${KUBEBUILDER_VERSION_NAME} from $URL ..."
28
+ curl -L " $URL " | tar xz
29
+
30
+ echo " Downloaded these executable files into $NAME : "
31
+ ls " ${KUBEBUILDER_VERSION_NAME} _${OSEXT} _${ARCH} /bin"
32
+ mv ${KUBEBUILDER_VERSION_NAME} _${OSEXT} _${ARCH} kubebuilder && sudo mv -f kubebuilder /usr/local/
33
+ RETVAL=$?
34
+
35
+ if [ $RETVAL -eq 0 ]; then
36
+ echo " Add kubebuilder to your path; e.g copy paste in your shell and/or ~/.profile:"
37
+ echo " export PATH=\$ PATH:/usr/local/kubebuilder/bin"
38
+ else
39
+ echo " \n/usr/local/kubebuilder folder is not empty. Please delete or backup it before to install ${KUBEBUILDER_VERSION_NAME} "
40
+ fi
You can’t perform that action at this time.
0 commit comments