Fix fatal permission issue
Fix non-arch system execution installation arch system related software errors Fix the problem that the created user has login permissions, etc.
This commit is contained in:
parent
64ef1a250b
commit
b04a451f95
@ -2,7 +2,7 @@
|
||||
|
||||
#========================================================
|
||||
# System Required: CentOS 7+ / Debian 8+ / Ubuntu 16+ / Alpine 3+ /
|
||||
# Arch not tested
|
||||
# Arch has only been tested once, if there is any problem, please report with screenshots Dysf888@pm.me
|
||||
# Description: Nezha Monitoring Install Script
|
||||
# Github: https://github.com/naiba/nezha
|
||||
#========================================================
|
||||
@ -94,12 +94,32 @@ install_base() {
|
||||
(command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1 && command -v getenforce >/dev/null 2>&1) ||
|
||||
(install_soft curl wget git unzip)
|
||||
}
|
||||
install_arch(){
|
||||
echo -e "${green}Info: ${plain} Archlinux needs to add nezha-agent user to install libselinux. It will be deleted automatically after installation. It is recommended to check manually\n"
|
||||
read -e -r -p "Do you need to install libselinux? [Y/n] " input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY])
|
||||
useradd -m nezha-agent
|
||||
sed -i "$ a\nezha-agent ALL=(ALL ) NOPASSWD:ALL" /etc/sudoers
|
||||
sudo -iu nezha-agent yay -S libselinux --noconfirm
|
||||
sed -i '/nezha-agent/d' /etc/sudoers && sleep 30s && killall -u nezha-agent&&userdel nezha-agent
|
||||
echo -e "${red}Info: ${plain}user nezha-agent has been deleted, Be sure to check it manually!\n"
|
||||
;;
|
||||
[nN][oO] | [nN])
|
||||
echo "Libselinux will not be installed"
|
||||
;;
|
||||
*)
|
||||
echo "Libselinux will not be installed"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
install_soft() {
|
||||
# The official Arch library does not contain selinux components
|
||||
(command -v yum >/dev/null 2>&1 && yum makecache && yum install $* selinux-policy -y) ||
|
||||
(command -v apt >/dev/null 2>&1 && apt update && apt install $* selinux-utils -y) ||
|
||||
(command -v pacman >/dev/null 2>&1 && pacman -Syu $*) ||
|
||||
(command -v pacman >/dev/null 2>&1 && pacman -Syu $* yay --noconfirm && install_arch) ||
|
||||
(command -v apt-get >/dev/null 2>&1 && apt-get update && apt-get install $* selinux-utils -y) ||
|
||||
(command -v apk >/dev/null 2>&1 && apk update && apk add $* -f)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user