6 changed files with 0 additions and 295 deletions
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK----- |
||||
Version: GnuPG v2.0.14 (GNU/Linux) |
||||
|
||||
mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBD |
||||
A+bGFOwyhbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9 |
||||
CUliQe324qvObU2QRtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZ |
||||
j3SF1SPO+TB5QrHkrQHBsmX+Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd |
||||
1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD |
||||
2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vABEBAAG0RUVsYXN0aWNzZWFyY2gg |
||||
KEVsYXN0aWNzZWFyY2ggU2lnbmluZyBLZXkpIDxkZXZfb3BzQGVsYXN0aWNzZWFy |
||||
Y2gub3JnPokBOAQTAQIAIgUCUjceygIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgEC |
||||
F4AACgkQ0n1mbNiOQrRzjAgAlTUQ1mgo3nK6BGXbj4XAJvuZDG0HILiUt+pPnz75 |
||||
nsf0NWhqR4yGFlmpuctgCmTD+HzYtV9fp9qW/bwVuJCNtKXk3sdzYABY+Yl0Cez/ |
||||
7C2GuGCOlbn0luCNT9BxJnh4mC9h/cKI3y5jvZ7wavwe41teqG14V+EoFSn3NPKm |
||||
TxcDTFrV7SmVPxCBcQze00cJhprKxkuZMPPVqpBS+JfDQtzUQD/LSFfhHj9eD+Xe |
||||
8d7sw+XvxB2aN4gnTlRzjL1nTRp0h2/IOGkqYfIG9rWmSLNlxhB2t+c0RsjdGM4/ |
||||
eRlPWylFbVMc5pmDpItrkWSnzBfkmXL3vO2X3WvwmSFiQbkBDQRSNx7KAQgA5JUl |
||||
zcMW5/cuyZR8alSacKqhSbvoSqqbzHKcUQZmlzNMKGTABFG1yRx9r+wa/fvqP6OT |
||||
RzRDvVS/cycws8YX7Ddum7x8uI95b9ye1/Xy5noPEm8cD+hplnpU+PBQZJ5XJ2I+ |
||||
1l9Nixx47wPGXeClLqcdn0ayd+v+Rwf3/XUJrvccG2YZUiQ4jWZkoxsA07xx7Bj+ |
||||
Lt8/FKG7sHRFvePFU0ZS6JFx9GJqjSBbHRRkam+4emW3uWgVfZxuwcUCn1ayNgRt |
||||
KiFv9jQrg2TIWEvzYx9tywTCxc+FFMWAlbCzi+m4WD+QUWWfDQ009U/WM0ks0Kww |
||||
EwSk/UDuToxGnKU2dQARAQABiQEfBBgBAgAJBQJSNx7KAhsMAAoJENJ9ZmzYjkK0 |
||||
c3MIAIE9hAR20mqJWLcsxLtrRs6uNF1VrpB+4n/55QU7oxA1iVBO6IFu4qgsF12J |
||||
TavnJ5MLaETlggXY+zDef9syTPXoQctpzcaNVDmedwo1SiL03uMoblOvWpMR/Y0j |
||||
6rm7IgrMWUDXDPvoPGjMl2q1iTeyHkMZEyUJ8SKsaHh4jV9wp9KmC8C+9CwMukL7 |
||||
vM5w8cgvJoAwsp3Fn59AxWthN3XJYcnMfStkIuWgR7U2r+a210W6vnUxU4oN0PmM |
||||
cursYPyeV0NX/KQeUeNMwGTFB6QHS/anRaGQewijkrYYoTNtfllxIu9XYmiBERQ/ |
||||
qPDlGRlOgVTd9xUfHFkzB52c70E= |
||||
=92oX |
||||
-----END PGP PUBLIC KEY BLOCK----- |
Binary file not shown.
Binary file not shown.
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
[epel] |
||||
name=Extra Packages for Enterprise Linux 7 - $basearch |
||||
baseurl=http://mirrors.aliyun.com/epel/7/$basearch |
||||
#metalink=http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir |
||||
failovermethod=priority |
||||
enabled=1 |
||||
gpgcheck=0 |
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 |
||||
|
||||
[epel-debuginfo] |
||||
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug |
||||
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug |
||||
#metalink=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir |
||||
failovermethod=priority |
||||
enabled=0 |
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 |
||||
gpgcheck=0 |
||||
|
||||
[epel-source] |
||||
name=Extra Packages for Enterprise Linux 7 - $basearch - Source |
||||
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS |
||||
#metalink=http://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir |
||||
failovermethod=priority |
||||
enabled=0 |
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 |
||||
gpgcheck=0 |
@ -1,237 +0,0 @@
@@ -1,237 +0,0 @@
|
||||
#!/bin/bash |
||||
|
||||
set -o errexit |
||||
|
||||
#判断系统版本 |
||||
check_sys(){ |
||||
local checkType=$1 |
||||
local value=$2 |
||||
|
||||
local release='' |
||||
local systemPackage='' |
||||
local packageSupport='' |
||||
|
||||
if [[ "$release" == "" ]] || [[ "$systemPackage" == "" ]] || [[ "$packageSupport" == "" ]];then |
||||
|
||||
if [[ -f /etc/redhat-release ]];then |
||||
release="centos" |
||||
systemPackage="yum" |
||||
packageSupport=true |
||||
|
||||
elif cat /etc/issue | grep -q -E -i "debian";then |
||||
release="debian" |
||||
systemPackage="apt" |
||||
packageSupport=true |
||||
|
||||
elif cat /etc/issue | grep -q -E -i "ubuntu";then |
||||
release="ubuntu" |
||||
systemPackage="apt" |
||||
packageSupport=true |
||||
|
||||
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat";then |
||||
release="centos" |
||||
systemPackage="yum" |
||||
packageSupport=true |
||||
|
||||
elif cat /proc/version | grep -q -E -i "debian";then |
||||
release="debian" |
||||
systemPackage="apt" |
||||
packageSupport=true |
||||
|
||||
elif cat /proc/version | grep -q -E -i "ubuntu";then |
||||
release="ubuntu" |
||||
systemPackage="apt" |
||||
packageSupport=true |
||||
|
||||
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat";then |
||||
release="centos" |
||||
systemPackage="yum" |
||||
packageSupport=true |
||||
|
||||
else |
||||
release="other" |
||||
systemPackage="other" |
||||
packageSupport=false |
||||
fi |
||||
fi |
||||
|
||||
echo -e "release=$release\nsystemPackage=$systemPackage\npackageSupport=$packageSupport\n" > /tmp/ezhttp_sys_check_result |
||||
|
||||
if [[ $checkType == "sysRelease" ]]; then |
||||
if [ "$value" == "$release" ];then |
||||
return 0 |
||||
else |
||||
return 1 |
||||
fi |
||||
|
||||
elif [[ $checkType == "packageManager" ]]; then |
||||
if [ "$value" == "$systemPackage" ];then |
||||
return 0 |
||||
else |
||||
return 1 |
||||
fi |
||||
|
||||
elif [[ $checkType == "packageSupport" ]]; then |
||||
if $packageSupport;then |
||||
return 0 |
||||
else |
||||
return 1 |
||||
fi |
||||
fi |
||||
} |
||||
|
||||
# 安装依赖 |
||||
install_depend() { |
||||
if check_sys sysRelease ubuntu;then |
||||
apt-get update |
||||
apt-get -y install wget python-minimal |
||||
elif check_sys sysRelease centos;then |
||||
yum install -y wget python |
||||
fi |
||||
} |
||||
|
||||
get_sys_ver() { |
||||
cat > /tmp/sys_ver.py <<EOF |
||||
import platform |
||||
import re |
||||
|
||||
sys_ver = platform.platform() |
||||
sys_ver = re.sub(r'.*-with-(.*)-.*',"\g<1>",sys_ver) |
||||
if sys_ver.startswith("centos-7"): |
||||
sys_ver = "centos-7" |
||||
if sys_ver.startswith("centos-6"): |
||||
sys_ver = "centos-6" |
||||
print sys_ver |
||||
EOF |
||||
echo `python /tmp/sys_ver.py` |
||||
} |
||||
|
||||
download(){ |
||||
local url1=$1 |
||||
local url2=$2 |
||||
local filename=$3 |
||||
|
||||
# 检查文件是否存在 |
||||
# if [[ -f $filename ]]; then |
||||
# echo "$filename 文件已经存在,忽略" |
||||
# return |
||||
# fi |
||||
|
||||
speed1=`curl -m 5 -L -s -w '%{speed_download}' "$url1" -o /dev/null || true` |
||||
speed1=${speed1%%.*} |
||||
speed2=`curl -m 5 -L -s -w '%{speed_download}' "$url2" -o /dev/null || true` |
||||
speed2=${speed2%%.*} |
||||
echo "speed1:"$speed1 |
||||
echo "speed2:"$speed2 |
||||
url="$url1\n$url2" |
||||
if [[ $speed2 -gt $speed1 ]]; then |
||||
url="$url2\n$url1" |
||||
fi |
||||
echo -e $url | while read l;do |
||||
echo "using url:"$l |
||||
wget --dns-timeout=5 --connect-timeout=5 --read-timeout=10 --tries=2 "$l" -O $filename && break |
||||
done |
||||
|
||||
|
||||
} |
||||
|
||||
sync_time(){ |
||||
echo "start to sync time and add sync command to cronjob..." |
||||
|
||||
if check_sys sysRelease ubuntu || check_sys sysRelease debian;then |
||||
apt-get -y update |
||||
apt-get -y install ntpdate wget |
||||
/usr/sbin/ntpdate -u pool.ntp.org || true |
||||
! grep -q "/usr/sbin/ntpdate -u pool.ntp.org" /var/spool/cron/crontabs/root > /dev/null 2>&1 && echo '*/10 * * * * /usr/sbin/ntpdate -u pool.ntp.org > /dev/null 2>&1 || (date_str=`curl update.cdnfly.cn/common/datetime` && timedatectl set-ntp false && echo $date_str && timedatectl set-time "$date_str" )' >> /var/spool/cron/crontabs/root |
||||
service cron restart |
||||
elif check_sys sysRelease centos; then |
||||
yum -y install ntpdate wget |
||||
/usr/sbin/ntpdate -u pool.ntp.org || true |
||||
! grep -q "/usr/sbin/ntpdate -u pool.ntp.org" /var/spool/cron/root > /dev/null 2>&1 && echo '*/10 * * * * /usr/sbin/ntpdate -u pool.ntp.org > /dev/null 2>&1 || (date_str=`curl update.cdnfly.cn/common/datetime` && timedatectl set-ntp false && echo $date_str && timedatectl set-time "$date_str" )' >> /var/spool/cron/root |
||||
service crond restart |
||||
fi |
||||
|
||||
# 时区 |
||||
rm -f /etc/localtime |
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime |
||||
|
||||
if /sbin/hwclock -w;then |
||||
return |
||||
fi |
||||
|
||||
|
||||
} |
||||
|
||||
need_sys() { |
||||
SYS_VER=`python -c "import platform;import re;sys_ver = platform.platform();sys_ver = re.sub(r'.*-with-(.*)-.*','\g<1>',sys_ver);print sys_ver;"` |
||||
if [[ $SYS_VER =~ "Ubuntu-16.04" ]];then |
||||
echo "$sys_ver" |
||||
elif [[ $SYS_VER =~ "centos-7" ]]; then |
||||
SYS_VER="centos-7" |
||||
echo $SYS_VER |
||||
else |
||||
echo "目前只支持ubuntu-16.04和Centos-7" |
||||
exit 1 |
||||
fi |
||||
} |
||||
|
||||
install_depend |
||||
need_sys |
||||
sync_time |
||||
|
||||
# 解析命令行参数 |
||||
TEMP=`getopt -o h --long help,ver:,no-mysql,only-mysql,no-es,only-es,master-ip:,es-ip:,es-dir:,es-pwd:,mysql-ip:,ignore-ntp -- "$@"` |
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi |
||||
eval set -- "$TEMP" |
||||
|
||||
while true ; do |
||||
case "$1" in |
||||
-h|--help) help ; exit 1 ;; |
||||
--ver) VER=$2 ; shift 2 ;; |
||||
--) shift ; break ;; |
||||
*) break ;; |
||||
esac |
||||
done |
||||
|
||||
if [[ $VER == "" ]]; then |
||||
# 获取最新版本 |
||||
echo "获取最新版..." |
||||
latest_version=`curl -s 'http://auth.cdnfly.cn/master/upgrades?latest=1' | grep -Po 'v\d+\.\d+.\d+' || true` |
||||
if [[ "$latest_version" == "" ]]; then |
||||
echo "获取最新版失败,请先登录官网填入主控IP" |
||||
exit 1 |
||||
fi |
||||
|
||||
echo "最新版本为$latest_version" |
||||
dir_name="cdnfly-master-$latest_version" |
||||
tar_gz_name="$dir_name-$(get_sys_ver).tar.gz" |
||||
|
||||
else |
||||
# 安装指定版本 |
||||
if [[ ! `echo "$VER" | grep -P "^v\d+\.\d+\.\d+$"` ]]; then |
||||
echo "指定的版本格式不正确,应该类似为v4.0.1" |
||||
exit 1 |
||||
fi |
||||
|
||||
dir_name="cdnfly-master-$VER" |
||||
tar_gz_name="$dir_name-$(get_sys_ver).tar.gz" |
||||
echo "安装指定版本$VER" |
||||
fi |
||||
|
||||
cd /opt/ |
||||
download "http://auth.fikkey.com/cdnfly/master/$tar_gz_name" "http://auth.fikkey.com/cdnfly/master/$tar_gz_name" "$tar_gz_name" |
||||
|
||||
tar xf $tar_gz_name |
||||
rm -rf cdnfly |
||||
mv $dir_name cdnfly |
||||
|
||||
# 开始安装 |
||||
cd /opt/cdnfly/master |
||||
chmod +x install.sh |
||||
./install.sh $@ |
||||
|
||||
if [ -f /opt/cdnfly/master/view/upgrade.so ]; then |
||||
sed -i "s/https:\/\/update.cdnfly.cn\//http:\/\/auth.cdnfly.cn\/\/\/\//g" /opt/cdnfly/master/view/upgrade.so |
||||
supervisorctl -c /opt/cdnfly/master/conf/supervisord.conf reload |
||||
fi |
||||
|
Loading…
Reference in new issue