Refactor Omada install and improve repo suite mapping

Refactored omada-install.sh to use setup_java and setup_mongodb functions, simplifying Java and MongoDB installation logic. Improved manage_tool_repository in tools.func to provide explicit suite mapping and fallbacks for newer or unknown Debian and Ubuntu releases, enhancing compatibility with future distributions. Minor comment translations and cleanups included.
This commit is contained in:
CanbiZ 2025-11-06 09:29:37 +01:00
parent 78b4375319
commit 5552a2beb4
2 changed files with 56 additions and 22 deletions

View File

@ -17,31 +17,21 @@ msg_info "Installing Dependencies"
$STD apt install -y jsvc
msg_ok "Installed Dependencies"
msg_info "Checking CPU Features"
if lscpu | grep -q 'avx'; then
MONGODB_VERSION="8.0"
msg_ok "AVX detected: Using MongoDB 8.0"
MONGO_VERSION="8.0" setup_mongodb
else
MONGO_VERSION="4.4" setup_mongodb
fi
msg_info "Installing Azul Zulu Java"
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" -o "/etc/apt/trusted.gpg.d/zulu-repo.asc"
curl -fsSL "https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb" -o zulu-repo.deb
$STD dpkg -i zulu-repo.deb
$STD apt update
$STD apt -y install zulu21-jre-headless
msg_ok "Installed Azul Zulu Java"
JAVA_VERSION="21" setup_java
if ! dpkg -l | grep -q 'libssl1.1'; then
msg_info "Installing libssl (if needed)"
curl -fsSL "https://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1w-0+deb11u4_amd64.deb" -o "/tmp/libssl.deb"
$STD dpkg -i /tmp/libssl.deb
rm -f /tmp/libssl.deb
msg_ok "Installed libssl1.1"
fi
# if ! dpkg -l | grep -q 'libssl1.1'; then
# msg_info "Installing libssl (if needed)"
# curl -fsSL "https://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1w-0+deb11u4_amd64.deb" -o "/tmp/libssl.deb"
# $STD dpkg -i /tmp/libssl.deb
# rm -f /tmp/libssl.deb
# msg_ok "Installed libssl1.1"
# fi
msg_info "Installing Omada Controller"
OMADA_URL=$(curl -fsSL "https://support.omadanetworks.com/en/download/software/omada-controller/" |
@ -56,7 +46,7 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf "$OMADA_PKG" zulu-repo.deb
rm -rf "$OMADA_PKG"
$STD apt -y autoremove
$STD apt -y autoclean
$STD apt -y clean

View File

@ -450,7 +450,51 @@ manage_tool_repository() {
# Setup repository
local distro_codename
distro_codename=$(awk -F= '/^VERSION_CODENAME=/{print $2}' /etc/os-release)
# Suite mapping with fallback for newer releases not yet supported by upstream
if [[ "$distro_id" == "debian" ]]; then
case "$distro_codename" in
trixie | forky | sid)
# Testing/unstable releases fallback to latest stable suite
suite="bookworm"
;;
bookworm)
suite="bookworm"
;;
bullseye)
suite="bullseye"
;;
*)
# Unknown release: fallback to latest stable suite
msg_warn "Unknown Debian release '${distro_codename}', using bookworm"
suite="bookworm"
;;
esac
elif [[ "$distro_id" == "ubuntu" ]]; then
case "$distro_codename" in
oracular | plucky)
# Newer releases fallback to latest LTS
suite="noble"
;;
noble)
suite="noble"
;;
jammy)
suite="jammy"
;;
focal)
suite="focal"
;;
*)
# Unknown release: fallback to latest LTS
msg_warn "Unknown Ubuntu release '${distro_codename}', using noble"
suite="noble"
;;
esac
else
# For other distros, try generic fallback
suite=$(get_fallback_suite "$distro_id" "$distro_codename" "$repo_url")
fi
repo_component="main"
[[ "$distro_id" == "ubuntu" ]] && repo_component="multiverse"
@ -4188,12 +4232,12 @@ function setup_uv() {
local TMP_DIR=$(mktemp -d)
local CACHED_VERSION
# Trap für TMP Cleanup
# trap for TMP Cleanup
trap "rm -rf '$TMP_DIR'" EXIT
CACHED_VERSION=$(get_cached_version "uv")
# Architektur-Detection
# Architecture Detection
local ARCH=$(uname -m)
local OS_TYPE=""
local UV_TAR=""