From dfc16026862be7848d40ddb34833b5e7a4b3c5b0 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Mon, 16 Dec 2024 13:50:07 -0800 Subject: [PATCH] add install-oc.sh --- openshift-v4/scripts/install-oc.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 openshift-v4/scripts/install-oc.sh diff --git a/openshift-v4/scripts/install-oc.sh b/openshift-v4/scripts/install-oc.sh new file mode 100755 index 000000000..f19ae6d97 --- /dev/null +++ b/openshift-v4/scripts/install-oc.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +# Define the version or source of OpenShift CLI +OC_DOWNLOAD_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz" + +# Create a temporary directory for the download +TEMP_DIR=$(mktemp -d) +cd $TEMP_DIR + +# Download and extract the OpenShift CLI +echo "Downloading OpenShift CLI..." +curl -LO "$OC_DOWNLOAD_URL" +echo "Extracting OpenShift CLI..." +tar -xvf openshift-client-linux.tar.gz + +# Move the binaries to /usr/local/bin for global access +echo "Installing OpenShift CLI..." +sudo mv oc /usr/local/bin/ +sudo mv kubectl /usr/local/bin/ + +# Clean up temporary files +cd - +rm -rf $TEMP_DIR + +# Verify installation +echo "OpenShift CLI installed successfully:" +oc version --client