-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathupgrade.sh
More file actions
74 lines (64 loc) · 1.95 KB
/
upgrade.sh
File metadata and controls
74 lines (64 loc) · 1.95 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
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
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
ad_filter="https://git.io/Je2pC"
vf_path="/usr/local/v2ray.fun"
# 检查系统信息
if [ -f /etc/redhat-release ];then
OS='CentOS'
elif [ ! -z "`cat /etc/issue | grep bian`" ];then
OS='Debian'
elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then
OS='Ubuntu'
else
echo "Not support OS, Please reinstall OS and retry!"
exit 1
fi
# 安装依赖
if [[ ${OS} == 'CentOS' ]];then
curl --silent --location https://rpm.nodesource.com/setup_12.x | bash -
yum install curl wget vixie-cron crontabs unzip git ntp ntpdate lrzsz python socat nodejs -y
npm install -g qrcode
else
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get update
apt-get install curl cron unzip git ntp wget ntpdate python socat lrzsz nodejs -y
npm install -g qrcode
fi
# 重装V2ray.fun
rm -rf ${vf_path}
cd /usr/local/
git clone https://github.com/leitbogioro/v2ray.fun
cd ${vf_path}/
ad_filter_supplement(){
rm -rf /usr/bin/v2ray/h2y.dat
cd /usr/bin/v2ray
wget -qO h2y.dat ${ad_filter}
}
ad_filter_supplement
chmod +x ${vf_path}/*.py
# 重装操作菜单
rm -rf /usr/local/bin/v2ray
ln -sf ${vf_path}/v2ray /usr/local/bin/
chmod +x /usr/local/bin/v2ray
# 更新Vray主程序
bash <(curl -L -s https://raw.githubusercontent.com/leitbogioro/v2ray.fun/master/go.sh)
# 删除旧的配置广告策略自动升级的自动任务
if [[ `grep -i "autoupad.sh" /etc/crontab` ]]; then
sed -i 'autoupad.sh' /etc/crontab
fi
if [[ ! `grep -i "v2ray.fun/maintain.sh" /etc/crontab` ]]; then
sed -i '$i 30 4 * * 0 root bash ${vf_path}/maintain.sh' /etc/crontab
fi
/etc/init.d/cron restart
# 初始化环境
python ${vf_path}/openport.py
service v2ray restart
cat /etc/rc.local | grep openport.py
if [[ $? -ne 0 ]]; then
cat>>/etc/rc.local<<EOF
python ${vf_path}/openport.py
EOF
chmod a+x /etc/rc.local
fi
clear
echo "脚本已更新!"