#!/bin/bash ## dir HAITAO ## for instll helm type helm if [ $? == 0 ];then echo "存在helm命令" else #检查PATH文件 if [ ! -d "/usr/local/bin" ];then mkdir -p /usr/local/bin cat >>/root/.bashrc<<EOF if [ -d /usr/local/bin ] ; then export PATH=/usr/local/bin:$PATH fi EOF source /root/.bashrc fi curl https://raw.githubusercontent.com if [ $? != 0 ];then #二进制安装(无法下载自动脚本时) wget https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz wait tar -zxvf helm-v3.7.2-linux-amd64.tar.gz mv linux-amd64/helm /usr/local/bin else #自动脚本安装helm(需要服务器能上外网) curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash fi type helm if [ $? == 0 ];then #添加自动补全 echo "source <(helm completion bash)" >> ~/.bash_profile echo "请执行 source <(helm completion bash) 当即生效自动补全,或者 重启ssh窗口!!!" else echo "安装失败,请检查!" fi fi #!/bin/bash ## dir HAITAO ## for instll helm type helm if [ $? == 0 ];then echo "存在helm命令" else #检查PATH文件 if [ ! -d "/usr/local/bin" ];then mkdir -p /usr/local/bin cat >>/root/.bashrc<<EOF if [ -d /usr/local/bin ] ; then export PATH=/usr/local/bin:$PATH fi EOF source /root/.bashrc fi curl https://raw.githubusercontent.com if [ $? != 0 ];then #二进制安装(无法下载自动脚本时) wget https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz wait tar -zxvf helm-v3.7.2-linux-amd64.tar.gz mv linux-amd64/helm /usr/local/bin else #自动脚本安装helm(需要服务器能上外网) curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash fi type helm if [ $? == 0 ];then #添加自动补全 echo "source <(helm completion bash)" >> ~/.bash_profile echo "请执行 source <(helm completion bash) 当即生效自动补全,或者 重启ssh窗口!!!" else echo "安装失败,请检查!" fi fi