Fix and simplify containerized MC_VERSION parsing

This commit is contained in:
2025-04-25 00:18:38 -04:00
parent 52b0b67b38
commit e2bae2693c

View File

@@ -421,7 +421,7 @@ get_latest_mc_version() {
mc_version_source="user input"
# Containerized package manager
elif create_mc_apt_container &&
MC_VERSION=$(sudo buildah run "$CNT" -- apt-cache policy "mediacenter${USER_MC_MVERSION:-${MC_VERSION%%.*}}" | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &&
MC_VERSION=$(sudo buildah run "$CNT" -- apt-cache policy "mediacenter${USER_MC_MVERSION:-${MC_VERSION%%.*}}" | awk '/Candidate:/ {sub(/-.*/, "", $2); print $2}' | sort -V | tail -n1) &&
[[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
mc_version_source="containerized package manager"
# Fallback to webscrape
@@ -1852,7 +1852,7 @@ create_mc_apt_container() {
Components: main
Architectures: '"$MC_ARCH"'
EOF
apt-get update --allow-insecure-repositories'
apt-get update'
# If user passes command strings run them in the container
for cmd in "${cmds[@]}"; do
sudo buildah run "$CNT" -- sh -c "$cmd"