From e19a559b0322179de46123bc4a65b95465b093f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=96=E5=A5=B3=E5=AD=A9=E7=9A=84=E5=B0=8F=E7=81=AB?= =?UTF-8?q?=E6=9F=B4?= <44471469+Erope@users.noreply.github.com> Date: Sun, 1 Dec 2024 21:53:48 +0800 Subject: [PATCH] Add scripts redirect for v0 (#23) --- install.sh | 20 ++++++++++++++++++++ install_en.sh | 20 ++++++++++++++++++++ nezha/template.sh | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/install.sh b/install.sh index ab2e29f..4fe77aa 100644 --- a/install.sh +++ b/install.sh @@ -253,6 +253,23 @@ update_script() { exit 0 } +install_agent_v0() { + shell_url="https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/v0/install.sh" + file_name="nezha_v0.sh" + if command -v wget >/dev/null 2>&1; then + wget -O "/tmp/install_v0.sh" "$shell_url" + elif command -v curl >/dev/null 2>&1; then + curl -o "/tmp/install_v0.sh" "$shell_url" + fi + chmod a+x /tmp/install_v0.sh + mv -f /tmp/install_v0.sh ./nezha_v0.sh + echo "3s后执行新脚本" + sleep 3s + clear + exec ./nezha_v0.sh "$@" + exit 0 +} + before_show_menu() { echo && info "* 按回车返回主菜单 *" && read temp show_menu @@ -608,6 +625,9 @@ if [ $# -gt 0 ]; then "update_script") update_script 0 ;; + "install_agent") + install_agent_v0 "$@" + ;; *) show_usage ;; esac else diff --git a/install_en.sh b/install_en.sh index d4f15f3..5b17358 100644 --- a/install_en.sh +++ b/install_en.sh @@ -253,6 +253,23 @@ update_script() { exit 0 } +install_agent_v0() { + shell_url="https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/v0/install.sh" + file_name="nezha_v0.sh" + if command -v wget >/dev/null 2>&1; then + wget -O "/tmp/install_v0.sh" "$shell_url" + elif command -v curl >/dev/null 2>&1; then + curl -o "/tmp/install_v0.sh" "$shell_url" + fi + chmod a+x /tmp/install_v0.sh + mv -f /tmp/install_v0.sh ./nezha_v0.sh + echo "Execute new script after 3s" + sleep 3s + clear + exec ./nezha_v0.sh "$@" + exit 0 +} + before_show_menu() { echo && info "* Press Enter to return to the main menu *" && read temp show_menu @@ -608,6 +625,9 @@ if [ $# -gt 0 ]; then "update_script") update_script 0 ;; + "install_agent") + install_agent_v0 "$@" + ;; *) show_usage ;; esac else diff --git a/nezha/template.sh b/nezha/template.sh index 9c2071f..815795c 100644 --- a/nezha/template.sh +++ b/nezha/template.sh @@ -253,6 +253,23 @@ update_script() { exit 0 } +install_agent_v0() { + shell_url="https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/v0/install.sh" + file_name="nezha_v0.sh" + if command -v wget >/dev/null 2>&1; then + wget -O "/tmp/install_v0.sh" "$shell_url" + elif command -v curl >/dev/null 2>&1; then + curl -o "/tmp/install_v0.sh" "$shell_url" + fi + chmod a+x /tmp/install_v0.sh + mv -f /tmp/install_v0.sh ./nezha_v0.sh + echo _("Execute new script after 3s") + sleep 3s + clear + exec ./nezha_v0.sh "$@" + exit 0 +} + before_show_menu() { echo && info _("* Press Enter to return to the main menu *") && read temp show_menu @@ -608,6 +625,9 @@ if [ $# -gt 0 ]; then "update_script") update_script 0 ;; + "install_agent") + install_agent_v0 "$@" + ;; *) show_usage ;; esac else