File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,3 +60,21 @@ function checkAndCleanVersion {
6060 echo " ${VERSION} "
6161 fi
6262}
63+
64+ # Usage: downloadFromGithub USER REPO VERSION PACKAGE_PREFIX PACKAGE_SUFFIX TARGET
65+ # Downloads a release package from github using the common architecture names
66+ # The package will be downloaded from github.com/USER/REPO/releases/VERSION/download/PACKAGE to the given TARGET file
67+ # where PACKAGE consists of PACKAGE_PREFIXARCHITECTURE.PACKAGE_SUFFIX.
68+ # Example: PACKAGE_PREFIX=krew_linux_, PACKAGE_SUFFIX=tar.gz on an arm architecture will download krew_linux_arm64.tar.gz
69+ function downloadFromGithub {
70+ USER=$1
71+ REPO=$2
72+ VERSION=$3
73+ PACKAGE_PREFIX=$4
74+ PACKAGE_SUFFIX=$5
75+ TARGET=$6
76+
77+ ARCH=" $( uname -m | sed -e ' s/x86_64/amd64/' -e ' s/\(arm\)\(64\)\?.*/\1\2/' -e ' s/aarch64$/arm64/' ) "
78+ PACKAGE=" ${PACKAGE_PREFIX}${ARCH} .${PACKAGE_SUFFIX} "
79+ execHandle " Downloading ${USER} /${REPO} @${VERSION} " curl -f -s -L " https://github.com/${USER} /${REPO} /releases/${VERSION} /download/${PACKAGE} " --output " ${TARGET} "
80+ }
Original file line number Diff line number Diff line change 1+ icon : " 🐾"
2+ title : " k9s"
3+ description : " Installs [k9s](https://k9scli.io/)"
4+ configuration :
5+ - " Environment K9S_VERSION (optional): Valid k9s version to install (defaults to latest)"
Original file line number Diff line number Diff line change 1+ DEBUG_k9s = yes
Original file line number Diff line number Diff line change 1+ command :
2+ k9s :
3+ exec : " /home/cloudcontrol/bin/k9s version"
4+ exit-status : 0
5+ stdout :
6+ - " Version:"
Original file line number Diff line number Diff line change 1+ . /feature-installer-utils.sh
2+
3+ if [ -n " ${K9S_VERSION} " ]
4+ then
5+ K9S_VERSION=$( checkAndCleanVersion " ${K9S_VERSION} " )
6+ else
7+ K9S_VERSION=" latest"
8+ fi
9+
10+ TEMPDIR=$( mktemp -d)
11+ cd " ${TEMPDIR} " || exit
12+
13+ downloadFromGithub derailed k9s " ${K9S_VERSION} " k9s_Linux_ tar.gz k9s.tar.gz
14+
15+ execHandle " Unpacking k9s" tar xzf k9s.tar.gz
16+ execHandle " Installing k9s" mv k9s /home/cloudcontrol/bin
17+ execHandle " Making k9s executable" chmod +x /home/cloudcontrol/bin/k9s
18+
19+ cd - & > /dev/null || exit
20+ rm -rf " ${TEMPDIR} "
You can’t perform that action at this time.
0 commit comments