script
Summary
This script will install CLI tools needed to command CSC cloud environments.
Internet
https://a3s.fi/cgi/cli-tools.sh
Code
Disclaimer of Warranty
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
#!/bin/bash
VENV_NAME = "csc-cloud-tools"
OC_TOOL_VER = "4.15.9"
if [ -f /etc/os-release ] ; then
. /etc/os-release
case $ID in
ubuntu| debian| linuxmint)
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y gcc python3-venv python3-dev python3-swiftclient rclone
;;
almalinux| fedora| centos| rhel| rocky)
sudo yum update -y
sudo yum install -y git-core unzip
;;
*)
echo "Unsupported distribution: ${ ID } "
;;
esac
else
echo "The /etc/os-release file does not exist. Unable to determine the environment."
fi
# python env (openstack etc)
python3 -m venv ~/${ VENV_NAME }
. ~/${ VENV_NAME } /bin/activate
pip3 install --upgrade pip
pip3 install python-openstackclient python-troveclient crypt4gh s3cmd
# oc
curl -sL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${ OC_TOOL_VER } /openshift-client-linux-${ OC_TOOL_VER } .tar.gz | tar xz -C ~/${ VENV_NAME } /bin/ kubectl oc
# allas-cli-utils
git clone --depth 1 https://github.com/CSCfi/allas-cli-utils
mv allas-cli-utils/* ~/${ VENV_NAME } /bin/
rm -fr allas-cli-utils
# rclone
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64
mv rclone ~/${ VENV_NAME } /bin/
cd ..
rm -fr rclone-*
mkdir -p ~/.config/rclone && echo "[allas]
type = swift
env_auth = true" >> ~/.config/rclone/rclone.conf