Skip to content

Commit

Permalink
add install-oc.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops committed Dec 16, 2024
1 parent 0133916 commit dfc1602
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions openshift-v4/scripts/install-oc.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dfc1602

Please sign in to comment.