Skip to content

Commit e1ef75f

Browse files
committedMay 20, 2023
fix update tips and test run
1 parent 5f59bdf commit e1ef75f

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed
 

‎src/core.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -806,14 +806,14 @@ manage() {
806806
[[ $is_test_run && ! $is_new_install ]] && {
807807
sleep 2
808808
if [[ ! $(pgrep -f $is_run_bin) ]]; then
809+
is_run_fail=${is_do_name_msg,,}
809810
[[ ! $is_no_manage_msg ]] && {
810811
msg
811812
warn "($is_do_msg) $is_do_name_msg 失败"
812813
_yellow "检测到运行失败, 自动执行测试运行."
813814
get test-run
814815
_yellow "测试结束, 请按 Enter 退出."
815816
}
816-
is_run_fail=${is_do_name_msg,,}
817817
fi
818818
}
819819
}
@@ -1570,17 +1570,20 @@ update() {
15701570
is_update_name=core
15711571
is_show_name=$is_core_name
15721572
is_run_ver=v${is_core_ver##* }
1573+
is_update_repo=$is_core_repo
15731574
;;
15741575
2 | sh)
15751576
is_update_name=sh
15761577
is_show_name="$is_core_name 脚本"
15771578
is_run_ver=$is_sh_ver
1579+
is_update_repo=$is_sh_repo
15781580
;;
15791581
3 | caddy)
15801582
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
15811583
is_update_name=caddy
15821584
is_show_name="Caddy"
15831585
is_run_ver=$is_caddy_ver
1586+
is_update_repo=$is_caddy_repo
15841587
;;
15851588
*)
15861589
err "无法识别 ($1), 请使用: $is_core update [core | sh | caddy] [ver]"
@@ -1605,8 +1608,8 @@ update() {
16051608
fi
16061609
download $is_update_name $is_new_ver
16071610
msg "更新成功, 当前 $is_show_name 版本: $(_green $is_new_ver)\n"
1608-
msg "$(_green 请查看更新说明: https://github.com/$is_sh_repo/releases/tag/$is_new_ver)\n"
1609-
manage restart $is_update_name &
1611+
msg "$(_green 请查看更新说明: https://github.com/$is_update_repo/releases/tag/$is_new_ver)\n"
1612+
[[ $is_update_name != 'sh' ]] && manage restart $is_update_name &
16101613
}
16111614

16121615
# main menu; if no prefer args.

‎src/download.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ get_latest_version() {
1010
;;
1111
caddy)
1212
name="Caddy"
13-
url="https://api.github.com/repos/caddyserver/caddy/releases/latest?v=$RANDOM"
13+
url="https://api.github.com/repos/$is_caddy_repo/releases/latest?v=$RANDOM"
1414
;;
1515
esac
1616
latest_ver=$(_wget -qO- $url | grep tag_name | egrep -o 'v([0-9.]+)')
@@ -49,7 +49,7 @@ download() {
4949
name="Caddy"
5050
tmpfile=$tmpdir/caddy.tar.gz
5151
# https://github.com/caddyserver/caddy/releases/download/v2.6.4/caddy_2.6.4_linux_amd64.tar.gz
52-
link="https://github.com/caddyserver/caddy/releases/download/${latest_ver}/caddy_${latest_ver:1}_linux_${caddy_arch}.tar.gz"
52+
link="https://github.com/${is_caddy_repo}/releases/download/${latest_ver}/caddy_${latest_ver:1}_linux_${caddy_arch}.tar.gz"
5353
download_file
5454
tar zxf $tmpfile -C $tmpdir
5555
cp -f $tmpdir/caddy $is_caddy_bin

‎src/init.sh

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ is_pkg="wget unzip jq qrencode"
7979
is_config_json=$is_core_dir/config.json
8080
is_caddy_bin=/usr/local/bin/caddy
8181
is_caddy_dir=/etc/caddy
82+
is_caddy_repo=caddyserver/caddy
8283
is_caddyfile=$is_caddy_dir/Caddyfile
8384
is_caddy_conf=$is_caddy_dir/$author
8485
is_caddy_service=$(systemctl list-units --full -all | grep caddy.service)

‎xray.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
args=$@
4-
is_sh_ver=v1.03
4+
is_sh_ver=v1.04
55

66
. /etc/xray/sh/src/init.sh

0 commit comments

Comments
 (0)
Please sign in to comment.