-
Notifications
You must be signed in to change notification settings - Fork 35
/
quick_start.sh
74 lines (64 loc) · 2.38 KB
/
quick_start.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#Install Latest Stable 1Panel Release
osCheck=`uname -a`
if [[ $osCheck =~ 'x86_64' ]];then
architecture="amd64"
elif [[ $osCheck =~ 'arm64' ]] || [[ $osCheck =~ 'aarch64' ]];then
architecture="arm64"
elif [[ $osCheck =~ 'armv7l' ]];then
architecture="armv7"
elif [[ $osCheck =~ 'ppc64le' ]];then
architecture="ppc64le"
elif [[ $osCheck =~ 's390x' ]];then
architecture="s390x"
else
echo "暂不支持的系统架构,请参阅官方文档,选择受支持的系统。"
exit 1
fi
if [[ ! ${INSTALL_MODE} ]];then
INSTALL_MODE="stable"
else
if [[ ${INSTALL_MODE} != "dev" && ${INSTALL_MODE} != "stable" ]];then
echo "请输入正确的安装模式(dev or stable)"
exit 1
fi
fi
VERSION=$(curl -s https://resource.fit2cloud.com/1panel/package/${INSTALL_MODE}/latest)
HASH_FILE_URL="https://resource.fit2cloud.com/1panel/package/${INSTALL_MODE}/${VERSION}/release/checksums.txt"
if [[ "x${VERSION}" == "x" ]];then
echo "获取最新版本失败,请稍候重试"
exit 1
fi
package_file_name="1panel-${VERSION}-linux-${architecture}.tar.gz"
package_download_url="https://resource.fit2cloud.com/1panel/package/${INSTALL_MODE}/${VERSION}/release/${package_file_name}"
expected_hash=$(curl -s "$HASH_FILE_URL" | grep "$package_file_name" | awk '{print $1}')
if [ -f ${package_file_name} ];then
actual_hash=$(sha256sum "$package_file_name" | awk '{print $1}')
if [[ "$expected_hash" == "$actual_hash" ]];then
echo "安装包已存在,跳过下载"
rm -rf 1panel-${VERSION}-linux-${architecture}
tar zxvf ${package_file_name}
cd 1panel-${VERSION}-linux-${architecture}
/bin/bash install.sh
exit 0
else
echo "已存在安装包,但是哈希值不一致,开始重新下载"
rm -f ${package_file_name}
fi
fi
echo "开始下载 1Panel ${VERSION} 版本在线安装包"
echo "安装包下载地址: ${package_download_url}"
curl -LOk -o ${package_file_name} ${package_download_url}
curl -sfL https://resource.fit2cloud.com/installation-log.sh | sh -s 1p install ${VERSION}
if [ ! -f ${package_file_name} ];then
echo "下载安装包失败,请稍候重试。"
exit 1
fi
tar zxvf ${package_file_name}
if [ $? != 0 ];then
echo "下载安装包失败,请稍候重试。"
rm -f ${package_file_name}
exit 1
fi
cd 1panel-${VERSION}-linux-${architecture}
/bin/bash install.sh