Add scripts redirect for v0 (#23)

This commit is contained in:
卖女孩的小火柴 2024-12-01 21:53:48 +08:00 committed by GitHub
parent 15012fed96
commit e19a559b03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 60 additions and 0 deletions

View File

@ -253,6 +253,23 @@ update_script() {
exit 0 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() { before_show_menu() {
echo && info "* 按回车返回主菜单 *" && read temp echo && info "* 按回车返回主菜单 *" && read temp
show_menu show_menu
@ -608,6 +625,9 @@ if [ $# -gt 0 ]; then
"update_script") "update_script")
update_script 0 update_script 0
;; ;;
"install_agent")
install_agent_v0 "$@"
;;
*) show_usage ;; *) show_usage ;;
esac esac
else else

View File

@ -253,6 +253,23 @@ update_script() {
exit 0 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() { before_show_menu() {
echo && info "* Press Enter to return to the main menu *" && read temp echo && info "* Press Enter to return to the main menu *" && read temp
show_menu show_menu
@ -608,6 +625,9 @@ if [ $# -gt 0 ]; then
"update_script") "update_script")
update_script 0 update_script 0
;; ;;
"install_agent")
install_agent_v0 "$@"
;;
*) show_usage ;; *) show_usage ;;
esac esac
else else

View File

@ -253,6 +253,23 @@ update_script() {
exit 0 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() { before_show_menu() {
echo && info _("* Press Enter to return to the main menu *") && read temp echo && info _("* Press Enter to return to the main menu *") && read temp
show_menu show_menu
@ -608,6 +625,9 @@ if [ $# -gt 0 ]; then
"update_script") "update_script")
update_script 0 update_script 0
;; ;;
"install_agent")
install_agent_v0 "$@"
;;
*) show_usage ;; *) show_usage ;;
esac esac
else else