feat: enable automated script updates directly from the Gitea repository
Main / build (push) Waiting to run

This commit is contained in:
2026-07-08 01:56:59 +08:00
parent 81206be8a4
commit 21f3d14277
2 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -1758,7 +1758,9 @@ update() {
is_update_repo=$is_core_repo
;;
2 | sh)
err "当前项目已净化,已禁用自动更新脚本以防止覆盖净化修改。"
is_update_name=sh
is_show_name="脚本"
is_run_ver=$is_sh_ver
;;
3 | caddy)
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
@@ -1771,6 +1773,13 @@ update() {
err "无法识别 ($1), 请使用: $is_core update [core | sh | caddy] [ver]"
;;
esac
load download.sh
if [[ $is_update_name == 'sh' ]]; then
msg "\n正在从 Gitea 获取最新脚本并应用...\n"
download sh latest
msg "更新成功, 当前脚本已更新为最新版。\n"
exit
fi
[[ $2 ]] && is_new_ver=v${2#v}
[[ $is_run_ver == $is_new_ver ]] && {
msg "\n自定义版本和当前 $is_show_name 版本一样, 无需更新.\n"
+2 -2
View File
@@ -40,9 +40,9 @@ download() {
sh)
name="$is_core_name 脚本"
tmpfile=$tmpdir/sh.tar.gz
link="https://github.com/${is_sh_repo}/releases/download/${latest_ver}/code.tar.gz"
link="https://git.lll.rest/svefnz/sing-box/archive/main.tar.gz"
download_file
tar zxf $tmpfile -C $is_sh_dir
tar zxf $tmpfile --strip-components 1 -C $is_sh_dir
chmod +x $is_sh_bin ${is_sh_bin/$is_core/sb}
;;
caddy)