From 23461000c9ef97084f8b9e6c2e78ff4f07619966 Mon Sep 17 00:00:00 2001 From: uubulb Date: Wed, 6 Nov 2024 10:50:44 +0800 Subject: [PATCH 1/4] installer: fix permission & move to another repository --- README.md | 2 +- script/install.sh | 18 ++++++++++-------- script/install_en.sh | 18 ++++++++++-------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index cf1c450b28..914c86b69e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
LOGO designed by 熊大 .

-GitHub release (with filter)    +GitHub release (with filter)  

:trollface: Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.

diff --git a/script/install.sh b/script/install.sh index 410569a47d..2efc6aed29 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,14 @@ 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 - fi - echo "当前最新版本为: ${new_version}" + #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}" + curl -sL https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o /tmp/nezha.sh mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh echo "3s后执行新脚本" @@ -621,6 +622,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 54d24c45e2..ffef368bf9 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,14 @@ 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 - fi - echo "The current latest version is: ${new_version}" + #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}" + curl -sL https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o /tmp/nezha.sh mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh echo "Execute new script after 3s" @@ -620,6 +621,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 From 08acfefd1878160005ee1cbee4b1e074d0146243 Mon Sep 17 00:00:00 2001 From: uubulb Date: Wed, 6 Nov 2024 11:06:09 +0800 Subject: [PATCH 2/4] update gitee url --- script/install.sh | 6 +++++- script/install_en.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/script/install.sh b/script/install.sh index 2efc6aed29..c3c34dcc8c 100755 --- a/script/install.sh +++ b/script/install.sh @@ -221,7 +221,11 @@ update_script() { # return 1 #fi #echo "当前最新版本为: ${new_version}" - curl -sL https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o /tmp/nezha.sh + 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 mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh echo "3s后执行新脚本" diff --git a/script/install_en.sh b/script/install_en.sh index ffef368bf9..031a44ad48 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -220,7 +220,11 @@ update_script() { # return 1 #fi #echo "The current latest version is: ${new_version}" - curl -sL https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o /tmp/nezha.sh + 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 mv -f /tmp/nezha.sh ./nezha.sh && chmod a+x ./nezha.sh echo "Execute new script after 3s" From 4910297809d26498c476fbae6bd348a2b595cf8e Mon Sep 17 00:00:00 2001 From: uubulb Date: Wed, 6 Nov 2024 11:23:45 +0800 Subject: [PATCH 3/4] update resource --- resource/template/component/server.html | 2 +- resource/template/dashboard-default/server.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resource/template/component/server.html b/resource/template/component/server.html index 8bb7a25154..daa59c3dae 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 09ad1707a1..1ed6cdc6ba 100644 --- a/resource/template/dashboard-default/server.html +++ b/resource/template/dashboard-default/server.html @@ -55,17 +55,17 @@ From 1a6fe2701bf7126e5bf86efe4cd91dc0aff8550b Mon Sep 17 00:00:00 2001 From: uubulb Date: Wed, 6 Nov 2024 11:38:35 +0800 Subject: [PATCH 4/4] ci: fix permission --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ee16a12ee..d8020d37fc 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%.*}"