diff --git a/ct/omada.sh b/ct/omada.sh index e75a28b6b..b0a4f90d1 100644 --- a/ct/omada.sh +++ b/ct/omada.sh @@ -27,18 +27,31 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + + msg_info "Updating MongoDB" + MONGODB_VERSION="8.0" + if ! lscpu | grep -q 'avx'; then + MONGODB_VERSION="4.4" + fi + + wget -qO- https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg + echo "deb [signed-by=/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg] http://repo.mongodb.org/apt/debian $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/${MONGODB_VERSION} main" >/etc/apt/sources.list.d/mongodb-org-${MONGODB_VERSION}.list + $STD apt-get update + $STD apt-get install -y --only-upgrade mongodb-org + msg_ok "Updated MongoDB to $MONGODB_VERSION" + + msg_info "Updating Omada Controller" latest_url=$(curl -s "https://support.omadanetworks.com/en/product/omada-software-controller/?resourceType=download" | grep -o 'https://static\.tp-link\.com/upload/software/[^"]*linux_x64[^"]*\.deb' | head -n 1) latest_version=$(basename "$latest_url") if [ -z "${latest_version}" ]; then msg_error "It seems that the server (tp-link.com) might be down. Please try again at a later time." exit fi - echo -e "Updating Omada Controller" + wget -qL ${latest_url} dpkg -i ${latest_version} rm -rf ${latest_version} - echo -e "Updated Omada Controller" - exit + msg_ok "Updated Omada Controller" } start diff --git a/install/omada-install.sh b/install/omada-install.sh index c8de262ea..3c16d72e1 100644 --- a/install/omada-install.sh +++ b/install/omada-install.sh @@ -14,34 +14,49 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y \ - curl \ - sudo \ - mc \ - gnupg \ - jsvc +$STD apt-get install -y curl sudo mc gnupg jsvc msg_ok "Installed Dependencies" -msg_info "Installing Azul Zulu" +msg_info "Checking CPU Features" +if lscpu | grep -q 'avx'; then + USE_AVX=true + MONGODB_VERSION="8.0" + msg_ok "AVX detected: Using MongoDB 8.0" +else + USE_AVX=false + MONGODB_VERSION="4.4" + msg_ok "No AVX detected: Using MongoDB 4.4" +fi + +msg_info "Installing Azul Zulu Java" wget -qO /etc/apt/trusted.gpg.d/zulu-repo.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" wget -q https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb $STD dpkg -i zulu-repo_1.0.0-3_all.deb $STD apt-get update $STD apt-get -y install zulu8-jdk -msg_ok "Installed Azul Zulu" +msg_ok "Installed Azul Zulu Java" -msg_info "Installing MongoDB" -libssl=$(curl -fsSL "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/" | grep -o 'libssl1\.1_1\.1\.1f-1ubuntu2\.2[^"]*amd64\.deb' | head -n1) -wget -qL http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl -$STD dpkg -i $libssl -wget -qL https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/3.6/multiverse/binary-amd64/mongodb-org-server_3.6.23_amd64.deb -$STD dpkg -i mongodb-org-server_3.6.23_amd64.deb -msg_ok "Installed MongoDB" +msg_info "Installing libssl (if needed)" +if ! dpkg -l | grep -q 'libssl1.1'; then + wget -qO /tmp/libssl.deb "https://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1w-0+deb11u2_amd64.deb" + $STD dpkg -i /tmp/libssl.deb + rm -f /tmp/libssl.deb + msg_ok "Installed libssl1.1" +else + msg_ok "libssl1.1 already installed" +fi +msg_info "Installing MongoDB $MONGODB_VERSION" +wget -qO- https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg +echo "deb [signed-by=/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg] http://repo.mongodb.org/apt/debian $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/${MONGODB_VERSION} main" >/etc/apt/sources.list.d/mongodb-org-${MONGODB_VERSION}.list +$STD apt-get update +$STD apt-get install -y mongodb-org +msg_ok "Installed MongoDB $MONGODB_VERSION" + +msg_info "Installing Omada Controller" latest_url=$(curl -s "https://support.omadanetworks.com/en/product/omada-software-controller/?resourceType=download" | grep -o 'https://static\.tp-link\.com/upload/software/[^"]*linux_x64[^"]*\.deb' | head -n 1) latest_version=$(basename "$latest_url") -msg_info "Installing Omada Controller" wget -qL ${latest_url} $STD dpkg -i ${latest_version} msg_ok "Installed Omada Controller" @@ -50,7 +65,7 @@ motd_ssh customize msg_info "Cleaning up" -rm -rf ${latest_version} mongodb-org-server_3.6.23_amd64.deb zulu-repo_1.0.0-3_all.deb $libssl +rm -rf ${latest_version} zulu-repo_1.0.0-3_all.deb $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"