fix arch installation error for en script

This commit is contained in:
iridiumR 2023-01-22 09:02:58 +08:00
parent 8eaf15281d
commit 4a1cda2f78
No known key found for this signature in database
GPG Key ID: 49735733EB1A32C8

View File

@ -101,7 +101,10 @@ install_arch(){
[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
sudo -iu nezha-agent bash -c 'gpg --keyserver keys.gnupg.net --recv-keys BE22091E3EF62275;
cd /tmp; git clone https://aur.archlinux.org/libsepol.git; cd libsepol; makepkg -si --noconfirm --asdeps; cd ..;
git clone https://aur.archlinux.org/libselinux.git; cd libselinux; makepkg -si --noconfirm; cd ..;
rm -rf libsepol libselinux'
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"
;;
@ -119,7 +122,7 @@ install_arch(){
install_soft() {
(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 $* yay --noconfirm && install_arch) ||
(command -v pacman >/dev/null 2>&1 && pacman -Syu $* base-devel git --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)
}