From 8eaf15281dcf416839b3d2cb6dd23c353e575b42 Mon Sep 17 00:00:00 2001 From: iridiumR <88495501+1ridic@users.noreply.github.com> Date: Sat, 21 Jan 2023 20:53:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20Arch=20=E7=9A=84?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Arch 的官方源中不含有`yay`,安装脚本亦没有检查`base-devel`包和`git`包是否存在,正确方法是克隆仓库后使用`makepkg`安装`libselinux` --- script/install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/install.sh b/script/install.sh index d29c778..04d0c1c 100755 --- a/script/install.sh +++ b/script/install.sh @@ -131,7 +131,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}提示: ${plain}已删除用户nezha-agent,请务必手动核查一遍!\n" ;; @@ -148,7 +151,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) } From 4a1cda2f7807311706c03b8b05ff67d85640e592 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Sun, 22 Jan 2023 09:02:58 +0800 Subject: [PATCH 2/3] fix arch installation error for en script --- script/install_en.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/install_en.sh b/script/install_en.sh index c20d37b..6a1fd53 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -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) } From b86a63aced0f4513bfa1c79e701890800c41d195 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Sun, 22 Jan 2023 09:48:44 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 似乎并不需要在这里再次安装 git --- script/install.sh | 2 +- script/install_en.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script/install.sh b/script/install.sh index 04d0c1c..f739365 100755 --- a/script/install.sh +++ b/script/install.sh @@ -151,7 +151,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 $* base-devel git --noconfirm && install_arch) || + (command -v pacman >/dev/null 2>&1 && pacman -Syu $* base-devel --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) } diff --git a/script/install_en.sh b/script/install_en.sh index 6a1fd53..a863ded 100755 --- a/script/install_en.sh +++ b/script/install_en.sh @@ -122,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 $* base-devel git --noconfirm && install_arch) || + (command -v pacman >/dev/null 2>&1 && pacman -Syu $* base-devel --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) }