From 80c680b8aa0015aaaf0d98c43e9eb0f2ac07af83 Mon Sep 17 00:00:00 2001 From: aixiao Date: Fri, 2 Dec 2022 09:31:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9build.sh=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E8=84=9A=E6=9C=AC,=20=E6=94=AF=E6=8C=81=E4=BD=8E=E7=89=88?= =?UTF-8?q?=E6=9C=ACDebian=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index a0f380e..0f2da37 100644 --- a/build.sh +++ b/build.sh @@ -30,8 +30,8 @@ pkg_install() apt -y install libsystemd-dev libjson-c-dev libpcre2-dev clamav-freshclam apt -y install libltdl-dev - #Debian系统使用libiptc库需要nftables切换到iptables - #Switching to the legacy version:(切换到 iptables) + # Debian系统使用libiptc库需要nftables切换到iptables + # Switching to the legacy version:(切换到 iptables) update-alternatives --set iptables /usr/sbin/iptables-legacy update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy update-alternatives --set arptables /usr/sbin/arptables-legacy @@ -52,9 +52,9 @@ pkg_install() yum -y install centos-release-scl yum -y install devtoolset-11-gcc - #source /opt/rh/devtoolset-11/enable #临时 + #source /opt/rh/devtoolset-11/enable #临时 - if test "`grep "devtoolset" /etc/profile`" != ""; then + if test "`grep "devtoolset" /etc/profile`" = ""; then echo "source /opt/rh/devtoolset-11/enable" >> /etc/profile #永久 fi source /opt/rh/devtoolset-11/enable @@ -73,13 +73,17 @@ main() make clean; make - if test -f /etc/cron.d/clamav-update; then # 去除自动更新病毒库 - mv /etc/cron.d/clamav-update /root + if test "$OS" = "centos"; then + if test -f /etc/cron.d/clamav-update; then # 去除自动更新病毒库 + mv /etc/cron.d/clamav-update /root + fi + + if test -f /etc/freshclam.conf; then # 更改病毒库镜像 + sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/freshclam.conf + fi + fi - if test -f /etc/freshclam.conf; then # 更改病毒库镜像 - sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/freshclam.conf - fi if test -f /etc/clamav/freshclam.conf; then sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/clamav/freshclam.conf @@ -88,6 +92,16 @@ main() fi + if test "$OS" = "debian"; then + condition=$(awk -v num1=${OS_VER} -v num2=11 'BEGIN{print(num1>num2)?"0":"1"}') + if test "$condition" = "1"; then # Debian系统版本小于11时, libclamav库版本低时 + cd clamscan/libclamav/; bash build.sh + cp /usr/lib/x86_64-linux-gnu/libclamav.so.9.0.5 /usr/lib/x86_64-linux-gnu/libclamav.so.9.0.5.backup + cp clamscan/libclamav/.libs/libclamav.so.9.0.5 /usr/lib/x86_64-linux-gnu/ + fi + fi + + tmux new-session -s main -d && tmux send -t main './rhost -d' ENTER tmux at -t main