Merge pull request #264 from dysf888/patch-3 [no ci]
Fix fatal permission issue
This commit is contained in:
commit
c027ae1396
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#========================================================
|
#========================================================
|
||||||
# System Required: CentOS 7+ / Debian 8+ / Ubuntu 16+ / Alpine 3+ /
|
# System Required: CentOS 7+ / Debian 8+ / Ubuntu 16+ / Alpine 3+ /
|
||||||
# Arch 未测试
|
# Arch 仅测试了一次,如有问题带截图反馈 dysf888@pm.me
|
||||||
# Description: 哪吒监控安装脚本
|
# Description: 哪吒监控安装脚本
|
||||||
# Github: https://github.com/naiba/nezha
|
# Github: https://github.com/naiba/nezha
|
||||||
#========================================================
|
#========================================================
|
||||||
@ -124,12 +124,31 @@ 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) ||
|
(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_soft curl wget git unzip)
|
||||||
}
|
}
|
||||||
|
install_arch(){
|
||||||
|
echo -e "${green}提示: ${plain} Arch安装libselinux需添加nezha-agent用户,安装完会自动删除,建议手动检查一次\n"
|
||||||
|
read -e -r -p "是否安装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}提示: ${plain}已删除用户nezha-agent,请务必手动核查一遍!\n"
|
||||||
|
;;
|
||||||
|
[nN][oO] | [nN])
|
||||||
|
echo "不安装libselinux"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "不安装libselinux"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
install_soft() {
|
install_soft() {
|
||||||
# Arch官方库不包含selinux等组件
|
|
||||||
(command -v yum >/dev/null 2>&1 && yum makecache && yum install $* selinux-policy -y) ||
|
(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 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 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)
|
(command -v apk >/dev/null 2>&1 && apk update && apk add $* -f)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user