Merge branch 'main' of https://github.com/AndreiJirohHaliliDev2006/.dotfiles into main
This commit is contained in:
commit
d9cbd74baf
|
@ -42,7 +42,7 @@ if [[ $TF_PYTHON_PATH != "" ]];then
|
|||
fi
|
||||
|
||||
# Export my Cloudflare API keys
|
||||
source ~/.dotfiles/secrets/cloudflare.api-keys
|
||||
#source ~/.dotfiles/secrets/cloudflare.api-keys
|
||||
|
||||
# do console cleanup
|
||||
#clear
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
|
||||
{
|
||||
|
||||
: PREIFX=${PREIFX:="$HOME/.local"}
|
||||
: HELM_INSTALL_DIR=${$HELM_INSTALL_DIR:="$PREIFX/bin"}
|
||||
export PATH=$PATH:$HOME/.local/bin
|
||||
|
||||
# Helm
|
||||
installHelm() {
|
||||
if [[ $PREFIX == "/usr/local" ]] && [[ $HELM_INSTALL_DIR == "/usr/local/bin" ]]; then
|
||||
export USE_SUDO=true
|
||||
else
|
||||
export USE_SUDO=false
|
||||
fi
|
||||
|
||||
echo "----> Installing Helm using the official script..."
|
||||
curl -fsSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||
unset USE_SUDO
|
||||
}
|
||||
|
||||
checkExistingInstalls() {
|
||||
if [[ $1 == "kubectl" ]]; then
|
||||
if [ -f "$HELM_INSTALL_DIR/kubectl" ]; then
|
||||
echo "----> Uninstalling old version of Kubectl..."
|
||||
rm -v $HELM_INSTALL_DIR/kubectl
|
||||
fi
|
||||
elif [[ $1 == "kompose" ]]; then
|
||||
if [ -f "$HELM_INSTALL_DIR/kompose" ]; then
|
||||
echo "----> Uninstalling old version of Kompose"
|
||||
rm -v $HELM_INSTALL_DIR/kompose
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Kubectl
|
||||
installKubectl() {
|
||||
checkExistingInstalls kubectl
|
||||
echo "----> Installing Kubectl..."
|
||||
if wget --fail "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl" -O $HELM_INSTALL_DIR/kubectl; then
|
||||
chmod +x $HELM_INSTALL_DIR/kubectl
|
||||
kubectl version --client
|
||||
else
|
||||
echo "error: Install script failed"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# Kompose
|
||||
installKompose() {
|
||||
checkExistingInstalls kompose
|
||||
echo "----> Installing Kompose..."
|
||||
curl-L https://github.com/kubernetes/kompose/releases/download/v1.22.0/kompose-linux-$ARCH -o $HELM_INSTALL_DIR/kompose
|
||||
chmod +x $HELM_INSTALL_DIR/kompose
|
||||
}
|
||||
|
||||
initArch() {
|
||||
ARCH=$(uname -m)
|
||||
case $ARCH in
|
||||
armv5*) ARCH="armv5";;
|
||||
armv6*) ARCH="armv6";;
|
||||
armv7*) ARCH="arm";;
|
||||
aarch64) ARCH="arm64";;
|
||||
x86) ARCH="386";;
|
||||
x86_64) ARCH="amd64";;
|
||||
i686) ARCH="386";;
|
||||
i386) ARCH="386";;
|
||||
esac
|
||||
}
|
||||
|
||||
main() {
|
||||
initArch
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
'helm')
|
||||
shift
|
||||
installHelm
|
||||
;;
|
||||
'kubectl')
|
||||
shift
|
||||
installKubectl
|
||||
;;
|
||||
'kompose')
|
||||
shift
|
||||
installKompose
|
||||
;;
|
||||
*) echo "Unsupported option, use the help command for avaipable options." && exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
installHelm
|
||||
installKubectl
|
||||
installKompose
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
}
|
|
@ -29,3 +29,6 @@
|
|||
insteadOf = https://bitbucket.org/
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[alias]
|
||||
change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '$OLD' ]]; then export $VAR='$NEW'; fi\" $@; }; f"
|
||||
signoff = "commit --signoff"
|
||||
|
|
Loading…
Reference in New Issue