Merge pull request #136 from CoiaPrant/patch-1
支持输入错误时删除 Co-authored-by: CoiaPrant <42506847+CoiaPrant@users.noreply.github.com>
This commit is contained in:
commit
06269f8a3e
@ -1,7 +1,7 @@
|
||||
<div align="center">
|
||||
<img width="500" style="max-width:100%" src="resource/static/brand.png" title="哪吒监控">
|
||||
<br><br>
|
||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.9.11&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.6.4-brightgreen?style=for-the-badge&logo=linux">
|
||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.9.11&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.6.5-brightgreen?style=for-the-badge&logo=linux">
|
||||
<br>
|
||||
<br>
|
||||
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
|
||||
|
@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
|
||||
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
||||
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
||||
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
||||
NZ_VERSION="v0.6.4"
|
||||
NZ_VERSION="v0.6.5"
|
||||
|
||||
red='\033[0;31m'
|
||||
green='\033[0;32m'
|
||||
@ -45,7 +45,7 @@ pre_check() {
|
||||
## China_IP
|
||||
if [[ $(curl -m 10 -s https://api.ip.sb/geoip | grep 'China') != "" ]]; then
|
||||
echo "根据ip.sb提供的信息,当前IP可能在中国"
|
||||
read -r -p "是否选用中国镜像完成安装? [Y/n] " input
|
||||
read -e -r -p "是否选用中国镜像完成安装? [Y/n] " input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY])
|
||||
echo "使用中国镜像"
|
||||
@ -79,12 +79,12 @@ pre_check() {
|
||||
|
||||
confirm() {
|
||||
if [[ $# > 1 ]]; then
|
||||
echo && read -p "$1 [默认$2]: " temp
|
||||
echo && read -e -p "$1 [默认$2]: " temp
|
||||
if [[ x"${temp}" == x"" ]]; then
|
||||
temp=$2
|
||||
fi
|
||||
else
|
||||
read -p "$1 [y/n]: " temp
|
||||
read -e -p "$1 [y/n]: " temp
|
||||
fi
|
||||
if [[ x"${temp}" == x"y" || x"${temp}" == x"Y" ]]; then
|
||||
return 0
|
||||
@ -220,9 +220,9 @@ modify_agent_config() {
|
||||
fi
|
||||
|
||||
echo "请先在管理面板上添加Agent,记录下密钥" &&
|
||||
read -p "请输入一个解析到面板所在IP的域名(不可套CDN): " nz_grpc_host &&
|
||||
read -p "请输入面板RPC端口: (5555)" nz_grpc_port &&
|
||||
read -p "请输入Agent 密钥: " nz_client_secret
|
||||
read -ep "请输入一个解析到面板所在IP的域名(不可套CDN): " nz_grpc_host &&
|
||||
read -ep "请输入面板RPC端口: (5555)" nz_grpc_port &&
|
||||
read -ep "请输入Agent 密钥: " nz_client_secret
|
||||
if [[ -z "${nz_grpc_host}" || -z "${nz_client_secret}" ]]; then
|
||||
echo -e "${red}所有选项都不能为空${plain}"
|
||||
before_show_menu
|
||||
@ -268,13 +268,13 @@ modify_dashboard_config() {
|
||||
|
||||
echo "关于 GitHub Oauth2 应用:在 https://github.com/settings/developers 创建,无需审核,Callback 填 http(s)://域名或IP/oauth2/callback" &&
|
||||
echo "关于 Gitee Oauth2 应用:在 https://gitee.com/oauth/applications 创建,无需审核,Callback 填 http(s)://域名或IP/oauth2/callback" &&
|
||||
read -p "请输入 OAuth2 提供商(gitee/github,默认 github): " nz_oauth2_type &&
|
||||
read -p "请输入 Oauth2 应用的 Client ID: " nz_github_oauth_client_id &&
|
||||
read -p "请输入 Oauth2 应用的 Client Secret: " nz_github_oauth_client_secret &&
|
||||
read -p "请输入 GitHub/Gitee 登录名作为管理员,多个以逗号隔开: " nz_admin_logins &&
|
||||
read -p "请输入站点标题: " nz_site_title &&
|
||||
read -p "请输入站点访问端口: (8008)" nz_site_port &&
|
||||
read -p "请输入用于 Agent 接入的 RPC 端口: (5555)" nz_grpc_port
|
||||
read -ep "请输入 OAuth2 提供商(gitee/github,默认 github): " nz_oauth2_type &&
|
||||
read -ep "请输入 Oauth2 应用的 Client ID: " nz_github_oauth_client_id &&
|
||||
read -ep "请输入 Oauth2 应用的 Client Secret: " nz_github_oauth_client_secret &&
|
||||
read -ep "请输入 GitHub/Gitee 登录名作为管理员,多个以逗号隔开: " nz_admin_logins &&
|
||||
read -ep "请输入站点标题: " nz_site_title &&
|
||||
read -ep "请输入站点访问端口: (8008)" nz_site_port &&
|
||||
read -ep "请输入用于 Agent 接入的 RPC 端口: (5555)" nz_grpc_port
|
||||
|
||||
if [[ -z "${nz_admin_logins}" || -z "${nz_github_oauth_client_id}" || -z "${nz_github_oauth_client_secret}" || -z "${nz_site_title}" ]]; then
|
||||
echo -e "${red}所有选项都不能为空${plain}"
|
||||
@ -467,7 +467,7 @@ show_menu() {
|
||||
————————————————-
|
||||
${green}0.${plain} 退出脚本
|
||||
"
|
||||
echo && read -p "请输入选择 [0-13]: " num
|
||||
echo && read -ep "请输入选择 [0-13]: " num
|
||||
|
||||
case "${num}" in
|
||||
0)
|
||||
|
Loading…
Reference in New Issue
Block a user