Skip to content

Commit 245cf04

Browse files
committed
修改为只有启用了才下载对应程序 #49
1 parent 732ccc3 commit 245cf04

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

luci-app-easytier/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include $(TOPDIR)/rules.mk
88

99
PKG_VERSION:=2.3.0
10-
PKG_RELEASE:=1
10+
PKG_RELEASE:=2
1111

1212
LUCI_TITLE:=LuCI support for EasyTier
1313
LUCI_DEPENDS:=+kmod-tun +luci-compat

luci-app-easytier/luasrc/model/cbi/easytier.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local http = luci.http
22
local nixio = require "nixio"
33

44
m = Map("easytier")
5-
m.description = translate('一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。 项目地址:<a href="https://github.com/EasyTier/EasyTier">github.com/EasyTier/EasyTier</a>&nbsp;&nbsp;<a href="http://easytier.cn">官网文档</a>&nbsp;&nbsp;<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=jhP2Z4UsEZ8wvfGPLrs0VwLKn_uz0Q_p&authKey=OGKSQLfg61YPCpVQuvx%2BxE7hUKBVBEVi9PljrDKbHlle6xqOXx8sOwPPTncMambK&noverify=0&group_code=949700262">QQ群</a>&nbsp;&nbsp;<a href="https://doc.oee.icu">菜鸟教程</a>')
5+
m.description = translate('一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。 项目地址:<a href="https://github.com/EasyTier/EasyTier" target="_blank">github.com/EasyTier/EasyTier</a>&nbsp;&nbsp;<a href="http://easytier.cn" target="_blank">官网文档</a>&nbsp;&nbsp;<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=jhP2Z4UsEZ8wvfGPLrs0VwLKn_uz0Q_p&authKey=OGKSQLfg61YPCpVQuvx%2BxE7hUKBVBEVi9PljrDKbHlle6xqOXx8sOwPPTncMambK&noverify=0&group_code=949700262" target="_blank">QQ群</a>&nbsp;&nbsp;<a href="https://doc.oee.icu">菜鸟教程</a>')
66

77
m:section(SimpleSection).template = "easytier/easytier_status"
88

@@ -28,7 +28,7 @@ btncq.write = function()
2828
end
2929

3030
etcmd = s:taboption("general",ListValue, "etcmd", translate("启动方式"),
31-
translate("官方Web控制台:<a href='https://easytier.cn/web'>easytier.cn/web</a><br>官方配置文件生成器:<a href='https://easytier.cn/web/index.html#/config_generator'>easytier.cn/web/index.html#/config_generator</a><br>注意配置RPC端口为15888"))
31+
translate("官方Web控制台:<a href='https://easytier.cn/web' target='_blank'>https://easytier.cn/web</a><br>官方配置文件生成器:<a href='https://easytier.cn/web/index.html#/config_generator' target='_blank'>https://easytier.cn/web/index.html#/config_generator</a><br>注意配置RPC端口为15888"))
3232
etcmd.default = "etcmd"
3333
etcmd:value("etcmd",translate("默认"))
3434
etcmd:value("config",translate("配置文件"))
@@ -54,7 +54,7 @@ et_config.write = function(self, section, value)
5454
end
5555

5656
web_config = s:taboption("general", Value, "web_config", translate("Web服务器地址"),
57-
translate("Web配置服务器地址。(-w 参数)<br>自建Web服务器 输入格式:udp://服务器地址:22020/账户名<br>官方Web服务器 输入格式:账户名 <br>官方Web控制台:<a href='https://easytier.cn/web'>easytier.cn/web</a>"))
57+
translate("Web配置服务器地址。(-w 参数)<br>自建Web服务器 输入格式:udp://服务器地址:22020/账户名<br>官方Web服务器 输入格式:账户名 <br>官方Web控制台:<a href='https://easytier.cn/web' target='_blank'>https://easytier.cn/web</a>"))
5858
web_config.placeholder = "admin"
5959
web_config:depends("etcmd", "web")
6060

luci-app-easytier/root/etc/init.d/easytier

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,32 +76,37 @@ check_bin() {
7676
tag="$( curl -k --connect-timeout 3 --user-agent "$user_agent" https://api.github.com/repos/EasyTier/EasyTier/releases/latest 2>&1 | grep 'tag_name' | cut -d\" -f4 )"
7777
[ -z "$tag" ] && tag="$( curl -Lk --connect-timeout 3 --user-agent "$user_agent" -s https://api.github.com/repos/EasyTier/EasyTier/releases/latest 2>&1 | grep 'tag_name' | cut -d\" -f4 )"
7878
fi
79-
[ -z "$tag"] && tag=v2.2.4
80-
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 未找到程序 $easytierbin 开始在线下载${tag},下载较慢耐心等候" >>/tmp/easytier.log
81-
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 未找到程序 $webbin 开始在线下载${tag},下载较慢耐心等候" >>/tmp/easytierweb.log
79+
[ -z "$tag"] && tag=v2.3.0
80+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 开始在线下载${tag}版本,${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip下载较慢耐心等候" >>/tmp/easytier.log
81+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 开始在线下载${tag}版本,${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip下载较慢耐心等候" >>/tmp/easytierweb.log
8282
mkdir -p "$path"
8383
for proxy in $proxys ; do
8484
if curl -L -k -o /tmp/easytier.zip --connect-timeout 10 --retry 3 "${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip" || \
8585
wget --no-check-certificate --timeout=10 --tries=3 -O /tmp/easytier.zip "${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip" ; then
8686
unzip -j -q -o /tmp/easytier.zip -d /tmp
8787
chmod +x /tmp/easytier-core /tmp/easytier-cli /tmp/easytier-web /tmp/easytier-web-embed || true
88-
mv -f /tmp/easytier-core ${path}/
89-
mv -f /tmp/easytier-cli ${path}/
90-
mv -f /tmp/easytier-web-embed ${webbin} || true
91-
chmod +x "$easytierbin"
92-
chmod +x "$webbin"
88+
if [ "$(uci -q get easytier.@easytier[0].enabled)" = "1" ] ; then
89+
mv -f /tmp/easytier-core ${path}/
90+
mv -f /tmp/easytier-cli ${path}/
91+
chmod +x "$easytierbin"
92+
if [ "$($easytierbin -h 2>&1 | wc -l)" -gt 3 ]; then
93+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${easytierbin} 下载成功" >>/tmp/easytier.log
94+
else
95+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip 下载不完整,请手动下载上传程序" >>/tmp/easytier.log
96+
fi
97+
fi
98+
if [ "$(uci -q get easytier.@easytierweb[0].enabled)" = "1" ] ; then
99+
mv -f /tmp/easytier-web-embed ${webbin} || true
100+
chmod +x "$webbin"
101+
if [ "$($webbin -h 2>&1 | wc -l)" -gt 3 ]; then
102+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${webbin} 下载成功" >>/tmp/easytierweb.log
103+
else
104+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip 下载不完整,请手动下载上传程序" >>/tmp/easytierweb.log
105+
fi
106+
fi
107+
93108
rm -rf /tmp/easytier.zip
94109
break
95-
if [ "$($easytierbin -h 2>&1 | wc -l)" -gt 3 ]; then
96-
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${easytierbin} 下载成功" >>/tmp/easytier.log
97-
else
98-
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip 下载不完整,请手动下载上传程序" >>/tmp/easytier.log
99-
fi
100-
if [ "$($webbin -h 2>&1 | wc -l)" -gt 3 ]; then
101-
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${webbin} 下载成功" >>/tmp/easytierweb.log
102-
else
103-
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip 下载不完整,请手动下载上传程序" >>/tmp/easytierweb.log
104-
fi
105110
else
106111
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip 下载失败,请手动下载上传程序" >>/tmp/easytier.log
107112
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : ${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip 下载失败,请手动下载上传程序" >>/tmp/easytierweb.log
@@ -413,6 +418,7 @@ start_et() {
413418
easytierbin=/tmp/easytier-core
414419
fi
415420
if [ ! -f "$easytierbin" ] || [ "$(($($easytierbin -h 2>&1 | wc -l)))" -lt 3 ] ; then
421+
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : $easytierbin 不存在或程序不完整,开始在线下载..." >>/tmp/easytier.log
416422
check_bin
417423
fi
418424
chmod +x "$easytierbin"

0 commit comments

Comments
 (0)