diff --git a/installJRMC b/installJRMC index eebbec3..6b31ae1 100755 --- a/installJRMC +++ b/installJRMC @@ -392,10 +392,7 @@ init() { echo "MC source -> target: $MC_REPO $MC_ARCH -> $BUILD_TARGET $ARCH" - # Retrieve the latest MC version number if we need it - if ((BUILD_SWITCH || LOCAL_INSTALL_SWITCH || CREATEREPO_SWITCH)); then - get_mc_version - fi + set_mc_version echo "Selected MC version $MC_VERSION from the $MC_REPO repo (via $MC_VERSION_SOURCE)" @@ -417,16 +414,26 @@ init() { } # @description Determines the latest JRiver MC version using several methods -get_mc_version() { +set_mc_version() { debug "${FUNCNAME[0]}()" declare -g MC_VERSION MC_VERSION_SOURCE - # User --mcversion if [[ -n $MC_VERSION_USER ]]; then MC_VERSION="$MC_VERSION_USER" MC_VERSION_SOURCE="user input" + return 0 + fi + + # Package manager will handle updates in other instances + if ! ((BUILD_SWITCH || LOCAL_INSTALL_SWITCH || CREATEREPO_SWITCH)); then + MC_VERSION="$MC_VERSION_HARDCODE" + MC_VERSION_SOURCE="hardcoded" + return 0 + fi + + # Determine latest version # Containerized package manager - elif create_mc_apt_container && + if create_mc_apt_container && MC_VERSION=$(sudo buildah run "$CNT" -- apt-cache policy "mediacenter${MC_MVERSION_USER:-${MC_VERSION_HARDCODE%%.*}}" | awk '/Candidate:/ {sub(/-.*/, "", $2); print $2}' | sort -V | tail -n1) && execute sudo buildah rm -f "$CNT" && [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then