Skip to content

Commit

Permalink
优化安装逻辑 (#325)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
1ridic authored Feb 23, 2024
1 parent ee3cda8 commit 0835f13
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br>
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.15.7-brightgreen?style=for-the-badge&logo=linux">
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.15.8-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p>
Expand Down
5 changes: 3 additions & 2 deletions script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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是开启状态,正在关闭!"
Expand Down
5 changes: 3 additions & 2 deletions script/install_en.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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!"
Expand Down

0 comments on commit 0835f13

Please sign in to comment.