-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathquick_start.sh
More file actions
executable file
·48 lines (41 loc) · 2 KB
/
quick_start.sh
File metadata and controls
executable file
·48 lines (41 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
#Install Latest Stable KubeOperator Release
# 定义离线文件下载地址
export CURRENT_DIR=$(cd "$(dirname "$0")";pwd)
export KO_VERSION=$(curl -s https://api.github.com/repos/KubeOperator/KubeOperator/releases/latest | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
nexus_download_url="https://kubeoperator.fit2cloud.com/nexus/nexus-${KO_VERSION}.tar.gz"
ansible_download_url="https://github.com/KubeOperator/KubeOperator/releases/latest/download/ansible-${KO_VERSION}.tar.gz"
kubeoperator_download_url="https://github.com/KubeOperator/KubeOperator/releases/latest/download/installer-${KO_VERSION}.tar.gz"
set -e
# 判断 wget 命令是否安装
if which wget;then
echo "开始下载离线包"
else
echo "wget 未安装,即将安装 wget"
yum install wget -y
if [ $? = 0 ];then
echo "wget 安装成功"
else
echo "wget 安装失败,请手动安装后再次执行脚本"
fi
fi
# 判断文件是否存在
if [ ! -d ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION} ];then
mkdir -p ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}
else
rm -rf ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}/*
fi
# 下载离线包
wget --no-check-certificate $nexus_download_url -P ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}
wget --no-check-certificate $ansible_download_url -P ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}
wget --no-check-certificate $kubeoperator_download_url -P ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}
# 解压离线包
if [ -f ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}/installer-${KO_VERSION}.tar.gz ];then
tar zxf ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}/installer-${KO_VERSION}.tar.gz -C ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}
fi
if [ -d ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}/installer ];then
cd ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}/installer/
/bin/bash install.sh
else
echo "安装失败: ${CURRENT_DIR}/kubeoperator-release-${KO_VERSION}/installer 不存在"
fi