From 0835f13f28b0e7129b51babd68b37cf921198de0 Mon Sep 17 00:00:00 2001 From: 1ridic <88495501+1ridic@users.noreply.github.com> Date: Fri, 23 Feb 2024 22:55:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=89=E8=A3=85=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20(#325)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Optimize install process If `getenforce` is not exist, then do not execute it. This fixes the `command not found` error on Arch Linux systems without SELinux installed. * bump installer version --- README.md | 2 +- script/install.sh | 5 +++-- script/install_en.sh | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a5b6bf8..e4c93e9 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 369686c..be01e0a 100755 --- a/script/install.sh +++ b/script/install.sh @@ -14,7 +14,7 @@ NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service" NZ_AGENT_SERVICERC="/etc/init.d/nezha-agent" NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service" NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard" -NZ_VERSION="v0.15.7" +NZ_VERSION="v0.15.8" red='\033[0;31m' green='\033[0;32m' @@ -269,7 +269,8 @@ install_dashboard_standalone() { selinux() { #判断当前的状态 - if [ "$os_alpine" != 1 ]; then + command -v getenforce >/dev/null 2>&1 + if [ $? -eq 0 ]; then getenforce | grep '[Ee]nfor' if [ $? -eq 0 ]; then echo -e "SELinux是开启状态,正在关闭!" diff --git a/script/install_en.sh b/script/install_en.sh index 43da8ad..4badc3a 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -14,7 +14,7 @@ NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service" NZ_AGENT_SERVICERC="/etc/init.d/nezha-agent" NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service" NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard" -NZ_VERSION="v0.15.7" +NZ_VERSION="v0.15.8" red='\033[0;31m' green='\033[0;32m' @@ -266,7 +266,8 @@ install_dashboard_standalone() { selinux() { #Check SELinux - if [ "$os_alpine" != 1 ]; then + command -v getenforce >/dev/null 2>&1 + if [ $? -eq 0 ]; then getenforce | grep '[Ee]nfor' if [ $? -eq 0 ]; then echo -e "SELinux running,closing now!"