From 60b9103a34ab72e6e05a4f96d33ff167ce67da30 Mon Sep 17 00:00:00 2001 From: DarmokNoob Date: Wed, 27 Nov 2024 06:53:44 -0800 Subject: [PATCH] Install MongoDB 4.2 for non-AVX CPUs in Unifi LXC (#319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Put in check and alternative to install older Mongo for CPUs that can't support AVX * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update json/unifi.json Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update json/unifi.json Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update json/unifi.json Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Updated suggested changes Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update json/unifi.json Updated Suggested Changes Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update install/unifi-install.sh Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> * Update unifi.sh * Update unifi.json --------- Co-authored-by: Håvard Gjøby Thom <34199185+havardthom@users.noreply.github.com> --- ct/unifi.sh | 4 ---- install/unifi-install.sh | 24 +++++++++++++++++++----- json/unifi.json | 4 ++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ct/unifi.sh b/ct/unifi.sh index 5be90bdab..d8813fd02 100644 --- a/ct/unifi.sh +++ b/ct/unifi.sh @@ -17,10 +17,6 @@ cat <<"EOF" EOF } header_info -if ! grep -q -m1 'avx[^ ]*' /proc/cpuinfo; then - echo "AVX instruction set is not supported on this CPU." - exit -fi echo -e "Loading..." APP="Unifi" var_disk="8" diff --git a/install/unifi-install.sh b/install/unifi-install.sh index 90a712473..6c37a6a6d 100644 --- a/install/unifi-install.sh +++ b/install/unifi-install.sh @@ -28,11 +28,25 @@ $STD apt-get update $STD apt-get install -y temurin-17-jre msg_ok "Installed Eclipse Temurin JRE" -msg_info "Installing MongoDB" -wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-7.0.gpg -echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" >/etc/apt/sources.list.d/mongodb-org-7.0.list -$STD apt-get update -$STD apt-get install -y mongodb-org +if grep -q 'avx' /proc/cpuinfo; then + msg_ok "No AVX Support Detected" + msg_info "Installing MongoDB 4.2" + if ! dpkg -l | grep -q "libssl1.1"; then + wget -q http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1n-0+deb10u6_amd64.deb + $STD dpkg -i libssl1.1_1.1.1n-0+deb10u6_amd64.deb + $STD apt-get install -f -y # Fix any broken dependencies + fi + wget -qO- https://www.mongodb.org/static/pgp/server-4.2.asc | gpg --dearmor > /usr/share/keyrings/mongodb-server-4.2.gpg + echo "deb [signed-by=/usr/share/keyrings/mongodb-server-4.2.gpg] https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" >/etc/apt/sources.list.d/mongodb-org-4.2.list + $STD apt-get update + $STD apt-get install -y mongodb-org=4.2.17 +else + msg_info "Installing MongoDB 7.0" + wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-7.0.gpg + echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" >/etc/apt/sources.list.d/mongodb-org-7.0.list + $STD apt-get update + $STD apt-get install -y mongodb-org +fi msg_ok "Installed MongoDB" msg_info "Installing UniFi Network Server" diff --git a/json/unifi.json b/json/unifi.json index cd9cd269e..66484787d 100644 --- a/json/unifi.json +++ b/json/unifi.json @@ -32,8 +32,8 @@ }, "notes": [ { - "text": "CPU with AVX Instruction Set required", + "text": "For non-AVX CPUs, MongoDB 4.2 is installed. Please note this is a legacy solution that may present security risks and could become unsupported in future updates.", "type": "warning" } ] -} \ No newline at end of file +}