From 3d6edd602c0db638a60eaa57ca220b3d9f83ebeb Mon Sep 17 00:00:00 2001
From: UUBulb <35923940+uubulb@users.noreply.github.com>
Date: Wed, 6 Nov 2024 16:44:31 +0800
Subject: [PATCH] ci: fix permission when packaging; move installer to another
repository (#470)
* installer: fix permission & move to another repository
* update gitee url
* update resource
* ci: fix permission
---
.github/workflows/release.yml | 1 +
README.md | 2 +-
resource/template/component/server.html | 2 +-
.../template/dashboard-default/server.html | 6 +++---
script/install.sh | 20 ++++++++++++-------
script/install_en.sh | 20 ++++++++++++-------
6 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9ee16a1..d8020d3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -73,6 +73,7 @@ jobs:
- name: Archive and compress binaries
run: |
find assets/*/*/* -type f | while read -r file; do
+ chmod +x $file
dir=$(dirname "$file")
filename=$(basename "$file")
fileWithoutExt="${filename%.*}"
diff --git a/README.md b/README.md
index cf1c450..914c86b 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
LOGO designed by 熊大 .
-
+
:trollface: Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.
diff --git a/resource/template/component/server.html b/resource/template/component/server.html
index 8bb7a25..daa59c3 100644
--- a/resource/template/component/server.html
+++ b/resource/template/component/server.html
@@ -53,7 +53,7 @@
{{if .Conf.GRPCHost}}
- curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod
+ curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o nezha.sh && chmod
+x nezha.sh && ./nezha.sh install_agent {{.Conf.GRPCHost}}
{{if .Conf.ProxyGRPCPort}}{{.Conf.ProxyGRPCPort}}{{else}}{{.Conf.GRPCPort}}{{end}}
{{if .Conf.TLS}}--tls{{end}}
diff --git a/resource/template/dashboard-default/server.html b/resource/template/dashboard-default/server.html
index 09ad170..1ed6cdc 100644
--- a/resource/template/dashboard-default/server.html
+++ b/resource/template/dashboard-default/server.html
@@ -55,17 +55,17 @@
diff --git a/script/install.sh b/script/install.sh
index 410569a..c3c34dc 100755
--- a/script/install.sh
+++ b/script/install.sh
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
-NZ_VERSION="v0.20.2"
+NZ_VERSION="v0.20.3"
red='\033[0;31m'
green='\033[0;32m'
@@ -214,13 +214,18 @@ select_version() {
update_script() {
echo "> 更新脚本"
- curl -sL https://${GITHUB_RAW_URL}/script/install.sh -o /tmp/nezha.sh
- new_version=$(grep "NZ_VERSION" /tmp/nezha.sh | head -n 1 | awk -F "=" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
- if [ -z "$new_version" ]; then
- echo "脚本获取失败,请检查本机能否链接 https://${GITHUB_RAW_URL}/script/install.sh"
- return 1
+ #curl -sL https://${GITHUB_RAW_URL}/script/install.sh -o /tmp/nezha.sh
+ #new_version=$(grep "NZ_VERSION" /tmp/nezha.sh | head -n 1 | awk -F "=" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
+ #if [ -z "$new_version" ]; then
+ # echo "脚本获取失败,请检查本机能否链接 https://${GITHUB_RAW_URL}/script/install.sh"
+ # return 1
+ #fi
+ #echo "当前最新版本为: ${new_version}"
+ if [ -z "$CN" ]; then
+ curl -sL https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o /tmp/nezha.sh
+ else
+ curl -sL https://gitee.com/naibahq/scripts/raw/main/install.sh -o /tmp/nezha.sh
fi
- echo "当前最新版本为: ${new_version}"
mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh
echo "3s后执行新脚本"
@@ -621,6 +626,7 @@ restart_and_update_standalone() {
fi
sudo wget -qO $NZ_DASHBOARD_PATH/app.zip "$NZ_DASHBOARD_URL" >/dev/null 2>&1 && sudo unzip -qq -o $NZ_DASHBOARD_PATH/app.zip -d $NZ_DASHBOARD_PATH && sudo mv $NZ_DASHBOARD_PATH/dashboard-linux-$os_arch $NZ_DASHBOARD_PATH/app && sudo rm $NZ_DASHBOARD_PATH/app.zip
+ sudo chmod +x $NZ_DASHBOARD_PATH/app
if [ "$os_alpine" != 1 ]; then
sudo systemctl enable nezha-dashboard
diff --git a/script/install_en.sh b/script/install_en.sh
index 54d24c4..031a44a 100755
--- a/script/install_en.sh
+++ b/script/install_en.sh
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
-NZ_VERSION="v0.20.2"
+NZ_VERSION="v0.20.3"
red='\033[0;31m'
green='\033[0;32m'
@@ -213,13 +213,18 @@ select_version() {
update_script() {
echo "> Update Script"
- curl -sL https://${GITHUB_RAW_URL}/script/install_en.sh -o /tmp/nezha.sh
- new_version=$(grep "NZ_VERSION" /tmp/nezha.sh | head -n 1 | awk -F "=" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
- if [ -z "$new_version" ]; then
- echo "Script failed to get, please check if the network can link https://${GITHUB_RAW_URL}/script/install.sh"
- return 1
+ #curl -sL https://${GITHUB_RAW_URL}/script/install_en.sh -o /tmp/nezha.sh
+ #new_version=$(grep "NZ_VERSION" /tmp/nezha.sh | head -n 1 | awk -F "=" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
+ #if [ -z "$new_version" ]; then
+ # echo "Script failed to get, please check if the network can link https://${GITHUB_RAW_URL}/script/install.sh"
+ # return 1
+ #fi
+ #echo "The current latest version is: ${new_version}"
+ if [ -z "$CN" ]; then
+ curl -sL https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o /tmp/nezha.sh
+ else
+ curl -sL https://gitee.com/naibahq/scripts/raw/main/install_en.sh -o /tmp/nezha.sh
fi
- echo "The current latest version is: ${new_version}"
mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh
echo "Execute new script after 3s"
@@ -620,6 +625,7 @@ restart_and_update_standalone() {
fi
sudo wget -qO $NZ_DASHBOARD_PATH/app.zip "$NZ_DASHBOARD_URL" >/dev/null 2>&1 && sudo unzip -qq -o $NZ_DASHBOARD_PATH/app.zip -d $NZ_DASHBOARD_PATH && sudo mv $NZ_DASHBOARD_PATH/dashboard-linux-$os_arch $NZ_DASHBOARD_PATH/app && sudo rm $NZ_DASHBOARD_PATH/app.zip
+ sudo chmod +x $NZ_DASHBOARD_PATH/app
if [ "$os_alpine" != 1 ]; then
sudo systemctl enable nezha-dashboard
|