diff --git a/ct/unifi.sh b/ct/unifi.sh index 4c092cfb..81ee47f1 100644 --- a/ct/unifi.sh +++ b/ct/unifi.sh @@ -16,11 +16,40 @@ cat <<"EOF" EOF } + +function run_avx_check { + if grep -q 'avx' /proc/cpuinfo; then + echo "AVX is supported. Proceeding with LXC setup." + else + echo "AVX instructions supported on this CPU. Would you like to explore alternatives?" + read -p "(y/n): " avx_response + if [[ "$avx_response" =~ ^[Yy]$ ]]; then + handle_avx_alternatives + else + echo "Exiting setup due to lack of AVX support." + exit 1 + fi + fi +} + +function handle_avx_alternatives { + echo "Choose an alternative installation method:" + echo "1) Install MongoDB 4.2 on LXC container" + echo "2) Install UniFi on Debian 12 VM (Coming Soon!)" + read -p "Enter your choice (1): " alt_choice + if [[ "$alt_choice" == "1" ]]; then + echo "Proceeding with MongoDB 4.2 installation on LXC..." + # Set a flag for the installer script + export MONGO_VERSION="4.2" + else + echo "Invalid choice. Only option 1 is currently available." + echo "VM installation option coming soon!" + exit 1 + fi +} + header_info -if ! grep -q -m1 'avx[^ ]*' /proc/cpuinfo; then - echo "AVX instruction set is not supported on this CPU." - exit -fi +run_avx_check echo -e "Loading..." APP="Unifi" var_disk="8" @@ -72,4 +101,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${APP}${CL} should be reachable by going to the following URL. - ${BL}https://${IP}:8443${CL} \n" + ${BL}https://${IP}:8443${CL} \n" \ No newline at end of file diff --git a/install/unifi-install.sh b/install/unifi-install.sh index 90a71247..f43bf506 100644 --- a/install/unifi-install.sh +++ b/install/unifi-install.sh @@ -29,10 +29,29 @@ $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 [ "$MONGO_VERSION" = "4.2" ]; then + # Check for libssl1.1 and install if missing + if ! dpkg -l | grep -q "libssl1.1"; then + msg_info "libssl1.1 not found. Installing..." + wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1n-0+deb10u6_amd64.deb + dpkg -i libssl1.1_1.1.1n-0+deb10u6_amd64.deb + apt-get install -f -y # Fix any broken dependencies + msg_ok "Installed libssl1.1" + else + msg_ok "libssl1.1 already installed" + fi + # Proceed with MongoDB 4.2 installation + 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 + # Default to MongoDB 7.0 installation + 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 cd9cd269..94519e71 100644 --- a/json/unifi.json +++ b/json/unifi.json @@ -32,8 +32,12 @@ }, "notes": [ { - "text": "CPU with AVX Instruction Set required", - "type": "warning" + "text": "CPU with AVX Instruction Set recommended", + "type": "note" + }, + { + "text": "For non-AVX CPUs, an alternative installation using MongoDB 4.2 is available. Please note this is a legacy solution that may present security risks and could become unsupported in future updates.", + "type": "attention" } ] } \ No newline at end of file