Skip to content

Instantly share code, notes, and snippets.

@aweiteka
Created September 1, 2017 15:12
Show Gist options
  • Save aweiteka/f14bc9e7546cca74dd0e28d679b8ab74 to your computer and use it in GitHub Desktop.
Save aweiteka/f14bc9e7546cca74dd0e28d679b8ab74 to your computer and use it in GitHub Desktop.
Download and install local OpenShift client from gzip tar
#!/bin/bash
# download and install openshift client 'oc' from gzip tar
if [[ $# -eq 0 ]]; then
echo "No parameter provided. Use the full URL to the gzip tar oc client to download."
echo "example: ${0} https://github.com/openshift/origin/releases/download/v3.6.0/openshift-origin-server-v3.6.0-c4dd4cf-linux-64bit.tar.gz"
exit
fi
localbin=${HOME}/.local/bin/
octmpdir=$(mktemp -d)
tmpclient=oc.tar.gz
echo "Downloading oc tools from ${1}"
curl -o ${octmpdir}/${tmpclient} -L ${1}
echo "extracting into ${octmpdir}"
tar -xzf ${octmpdir}/${tmpclient} -C ${octmpdir}
cp ${octmpdir}/openshift*/oc ${localbin}
rm -rf ${octmpdir}
echo "'oc' installed in ${localbin}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment