feat: enable automated script updates directly from the Gitea repository
Main / build (push) Waiting to run
Main / build (push) Waiting to run
This commit is contained in:
+10
-1
@@ -1758,7 +1758,9 @@ update() {
|
|||||||
is_update_repo=$is_core_repo
|
is_update_repo=$is_core_repo
|
||||||
;;
|
;;
|
||||||
2 | sh)
|
2 | sh)
|
||||||
err "当前项目已净化,已禁用自动更新脚本以防止覆盖净化修改。"
|
is_update_name=sh
|
||||||
|
is_show_name="脚本"
|
||||||
|
is_run_ver=$is_sh_ver
|
||||||
;;
|
;;
|
||||||
3 | caddy)
|
3 | caddy)
|
||||||
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
|
[[ ! $is_caddy ]] && err "不支持更新 Caddy."
|
||||||
@@ -1771,6 +1773,13 @@ update() {
|
|||||||
err "无法识别 ($1), 请使用: $is_core update [core | sh | caddy] [ver]"
|
err "无法识别 ($1), 请使用: $is_core update [core | sh | caddy] [ver]"
|
||||||
;;
|
;;
|
||||||
esac
|
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}
|
[[ $2 ]] && is_new_ver=v${2#v}
|
||||||
[[ $is_run_ver == $is_new_ver ]] && {
|
[[ $is_run_ver == $is_new_ver ]] && {
|
||||||
msg "\n自定义版本和当前 $is_show_name 版本一样, 无需更新.\n"
|
msg "\n自定义版本和当前 $is_show_name 版本一样, 无需更新.\n"
|
||||||
|
|||||||
+2
-2
@@ -40,9 +40,9 @@ download() {
|
|||||||
sh)
|
sh)
|
||||||
name="$is_core_name 脚本"
|
name="$is_core_name 脚本"
|
||||||
tmpfile=$tmpdir/sh.tar.gz
|
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
|
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}
|
chmod +x $is_sh_bin ${is_sh_bin/$is_core/sb}
|
||||||
;;
|
;;
|
||||||
caddy)
|
caddy)
|
||||||
|
|||||||
Reference in New Issue
Block a user