Report on user input for --mcversion

This commit is contained in:
2025-04-24 21:07:27 -04:00
parent e6f0c91eca
commit 5d7680c8dc

View File

@@ -287,14 +287,13 @@ init() {
esac esac
fi fi
echo "Target: $ARCH (MC: $MC_ARCH)"
# Normalize ID and set host-specific vars # Normalize ID and set host-specific vars
case $ID in case $ID in
debian|arch|fedora|centos) ;; debian|arch|fedora|centos) ;;
rhel|almalinux) ID="centos" ;; rhel|almalinux) ID="centos" ;;
linuxmint|neon|zorin|*ubuntu*) ID="ubuntu" ;; linuxmint|neon|zorin|*ubuntu*) ID="ubuntu" ;;
raspbian) ID="debian" ;; raspbian) ID="debian" ;;
manjaro) ID="arch" ;;
*suse*) *suse*)
ID="suse" ID="suse"
# Currently there is no remote repository for SUSE # Currently there is no remote repository for SUSE
@@ -387,12 +386,11 @@ init() {
MC_REPO=${UBUNTU_CODENAME:-${VERSION_CODENAME:-$MC_REPO}} MC_REPO=${UBUNTU_CODENAME:-${VERSION_CODENAME:-$MC_REPO}}
fi fi
MC_REPO="${USER_MC_REPO:-$MC_REPO}" # allow user override MC_REPO="${USER_MC_REPO:-$MC_REPO}" # allow user override
echo "Repository: $MC_REPO"
# Don't check for latest MC version if set by user or using --install=repo only echo "Target: MC $MC_REPO $MC_ARCH -> $BUILD_TARGET $ARCH"
if [[ -z $USER_MC_VERSION ]] &&
((BUILD_SWITCH || LOCAL_INSTALL_SWITCH || CREATEREPO_SWITCH)); then # Retrieves the latest MC version number if we need it
# Retrieves the latest MC version number if ((BUILD_SWITCH || LOCAL_INSTALL_SWITCH || CREATEREPO_SWITCH)); then
get_latest_mc_version get_latest_mc_version
fi fi
@@ -419,8 +417,11 @@ get_latest_mc_version() {
debug "${FUNCNAME[0]}()" debug "${FUNCNAME[0]}()"
local mc_version_source local mc_version_source
# User --mcversion
if [[ -n $USER_MC_VERSION ]]; then
mc_version_source="user input"
# Containerized package manager # Containerized package manager
if create_mc_apt_container && 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%%.*}}" | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &&
execute sudo buildah rm "$CNT" && execute sudo buildah rm "$CNT" &&
[[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -435,7 +436,7 @@ get_latest_mc_version() {
err "Warning! Using hardcoded version number" err "Warning! Using hardcoded version number"
fi fi
echo "Using latest MC version $MC_VERSION from the $MC_REPO repo (determined by $mc_version_source)" echo "Using MC version $MC_VERSION from the $MC_REPO repo (determined by $mc_version_source)"
} }
# @description Installs a package using the system package manager # @description Installs a package using the system package manager