Skip to content

Commit 1172662

Browse files
authored
Fix: Omada check for AVX Support and use the correct MongoDB Version (#2600)
* Update omada-install.sh * Update omada-install.sh * Update omada.sh
1 parent 43dc120 commit 1172662

File tree

2 files changed

+48
-20
lines changed

2 files changed

+48
-20
lines changed

ct/omada.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,31 @@ function update_script() {
2727
msg_error "No ${APP} Installation Found!"
2828
exit
2929
fi
30+
31+
msg_info "Updating MongoDB"
32+
MONGODB_VERSION="8.0"
33+
if ! lscpu | grep -q 'avx'; then
34+
MONGODB_VERSION="4.4"
35+
fi
36+
37+
wget -qO- https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg
38+
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
39+
$STD apt-get update
40+
$STD apt-get install -y --only-upgrade mongodb-org
41+
msg_ok "Updated MongoDB to $MONGODB_VERSION"
42+
43+
msg_info "Updating Omada Controller"
3044
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)
3145
latest_version=$(basename "$latest_url")
3246
if [ -z "${latest_version}" ]; then
3347
msg_error "It seems that the server (tp-link.com) might be down. Please try again at a later time."
3448
exit
3549
fi
36-
echo -e "Updating Omada Controller"
50+
3751
wget -qL ${latest_url}
3852
dpkg -i ${latest_version}
3953
rm -rf ${latest_version}
40-
echo -e "Updated Omada Controller"
41-
exit
54+
msg_ok "Updated Omada Controller"
4255
}
4356

4457
start

install/omada-install.sh

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,49 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17-
$STD apt-get install -y \
18-
curl \
19-
sudo \
20-
mc \
21-
gnupg \
22-
jsvc
17+
$STD apt-get install -y curl sudo mc gnupg jsvc
2318
msg_ok "Installed Dependencies"
2419

25-
msg_info "Installing Azul Zulu"
20+
msg_info "Checking CPU Features"
21+
if lscpu | grep -q 'avx'; then
22+
USE_AVX=true
23+
MONGODB_VERSION="8.0"
24+
msg_ok "AVX detected: Using MongoDB 8.0"
25+
else
26+
USE_AVX=false
27+
MONGODB_VERSION="4.4"
28+
msg_ok "No AVX detected: Using MongoDB 4.4"
29+
fi
30+
31+
msg_info "Installing Azul Zulu Java"
2632
wget -qO /etc/apt/trusted.gpg.d/zulu-repo.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9"
2733
wget -q https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb
2834
$STD dpkg -i zulu-repo_1.0.0-3_all.deb
2935
$STD apt-get update
3036
$STD apt-get -y install zulu8-jdk
31-
msg_ok "Installed Azul Zulu"
37+
msg_ok "Installed Azul Zulu Java"
38+
39+
msg_info "Installing libssl (if needed)"
40+
if ! dpkg -l | grep -q 'libssl1.1'; then
41+
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"
42+
$STD dpkg -i /tmp/libssl.deb
43+
rm -f /tmp/libssl.deb
44+
msg_ok "Installed libssl1.1"
45+
else
46+
msg_ok "libssl1.1 already installed"
47+
fi
3248

33-
msg_info "Installing MongoDB"
34-
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)
35-
wget -qL http://security.ubuntu.com/ubuntu/pool/main/o/openssl/$libssl
36-
$STD dpkg -i $libssl
37-
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
38-
$STD dpkg -i mongodb-org-server_3.6.23_amd64.deb
39-
msg_ok "Installed MongoDB"
49+
msg_info "Installing MongoDB $MONGODB_VERSION"
50+
wget -qO- https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc | gpg --dearmor >/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg
51+
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
52+
$STD apt-get update
53+
$STD apt-get install -y mongodb-org
54+
msg_ok "Installed MongoDB $MONGODB_VERSION"
4055

56+
msg_info "Installing Omada Controller"
4157
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)
4258
latest_version=$(basename "$latest_url")
4359

44-
msg_info "Installing Omada Controller"
4560
wget -qL ${latest_url}
4661
$STD dpkg -i ${latest_version}
4762
msg_ok "Installed Omada Controller"
@@ -50,7 +65,7 @@ motd_ssh
5065
customize
5166

5267
msg_info "Cleaning up"
53-
rm -rf ${latest_version} mongodb-org-server_3.6.23_amd64.deb zulu-repo_1.0.0-3_all.deb $libssl
68+
rm -rf ${latest_version} zulu-repo_1.0.0-3_all.deb
5469
$STD apt-get -y autoremove
5570
$STD apt-get -y autoclean
5671
msg_ok "Cleaned"

0 commit comments

Comments
 (0)