Update install.sh

This commit is contained in:
Zhu Rengen 2021-08-06 19:11:17 +08:00
parent 8715d38e02
commit 2a67e21538

View File

@ -203,7 +203,11 @@ install_agent() {
mv nezha-agent $NZ_AGENT_PATH &&
rm -rf nezha-agent_linux_${os_arch}.tar.gz README.md
if [[ $# == 3 ]]; then
modify_agent_config $1 $2 $3
else
modify_agent_config 0
fi
if [[ $# == 0 ]]; then
before_show_menu
@ -219,6 +223,7 @@ modify_agent_config() {
return 0
fi
if [[ $1 == 0 ]]; then
echo "请先在管理面板上添加Agent记录下密钥" &&
read -ep "请输入一个解析到面板所在IP的域名不可套CDN: " nz_grpc_host &&
read -ep "请输入面板RPC端口: (5555)" nz_grpc_port &&
@ -228,10 +233,16 @@ modify_agent_config() {
before_show_menu
return 1
fi
if [[ -z "${nz_grpc_port}" ]]; then
nz_grpc_port=5555
fi
else
nz_grpc_host=$1
nz_grpc_port=$2
nz_client_secret=$3
fi
sed -i "s/nz_grpc_host/${nz_grpc_host}/" ${NZ_AGENT_SERVICE}
sed -i "s/nz_grpc_port/${nz_grpc_port}/" ${NZ_AGENT_SERVICE}