diff --git a/installJRMC b/installJRMC index 6c4b237..01b8693 100755 --- a/installJRMC +++ b/installJRMC @@ -415,14 +415,14 @@ init() { # @description Determines the latest JRiver MC version using several methods get_latest_mc_version() { debug "Running: ${FUNCNAME[0]}" - local cnt mc_version_source + local mc_version_source - # Use generalized containerized package manager to determine latest MC version - if cnt=$(apt_mc_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) && + # Containerized package manager + if apt_mc_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) && + execute sudo buildah rm "$CNT" && [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then mc_version_source="containerized package manager" - execute sudo buildah rm "$cnt" # Fallback to webscrape elif MC_VERSION=$(download "https://yabb.jriver.com/interact/index.php/board,$BOARD_ID.html" "-" | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) && [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then @@ -770,24 +770,10 @@ acquire_deb_new() { fi # Define the repositories to search - cnt=$(sudo buildah from --quiet alpine:edge) && - sudo buildah run "$cnt" -- sh -c ' - apk add --no-cache apt curl gnupg &>/dev/null - curl -fsSL https://dist.jriver.com/mediacenter@jriver.com.gpg.key | gpg --dearmor -o /usr/share/keyrings/jriver-com-archive-keyring.gpg - mkdir -p /download - cat <<-EOF > /etc/apt/sources.list.d/jriver.sources - Types: deb - URIs: https://dist.jriver.com/latest/mediacenter/ - Signed-By: /usr/share/keyrings/jriver-com-archive-keyring.gpg - Suites: '"$MC_REPO"' - Components: main - Architectures: '"$MC_ARCH"' - EOF - apt-get update --allow-insecure-repositories &>/dev/null - cd /download - apt-get download --allow-unauthenticated mediacenter'"$MC_MVERSION"'' && - sudo buildah copy "$cnt" "/download/*.deb" "$OUTPUT_DIR/SOURCES/" && - sudo buildah rm "$cnt" + apt_mc_container && execute sudo buildah run "$CNT" -- sh -c " + mkdir -p /download && cd /download && apt-get download --allow-unauthenticated mediacenter$MC_MVERSION" && + execute sudo buildah copy "$CNT" "/download/*.deb" "$MC_DEB" && + execute sudo buildah rm "$CNT" # Return if the download was successful ((found)) && [[ -f $MC_DEB ]] @@ -1853,8 +1839,9 @@ download() { "${cmd[@]}" "$url" } apt_mc_container() { + declare -g CNT install_package --silent buildah &>/dev/null && - cnt=$(sudo buildah from --quiet alpine:edge 2>/dev/null) && + CNT=$(sudo buildah from --quiet alpine:edge 2>/dev/null) && sudo buildah run "$cnt" -- sh -c ' apk add --no-cache apt curl gnupg &>/dev/null curl -fsSL https://dist.jriver.com/mediacenter@jriver.com.gpg.key | gpg --dearmor -o /usr/share/keyrings/jriver-com-archive-keyring.gpg &>/dev/null @@ -1866,8 +1853,7 @@ apt_mc_container() { Components: main Architectures: '"$MC_ARCH"' EOF - apt-get update --allow-insecure-repositories &>/dev/null' && - echo "$cnt" + apt-get update --allow-insecure-repositories &>/dev/null' } # Roughly turn debugging on for pre-init