From 60603c087d3c94446bcd3e2b6237dd691415ec55 Mon Sep 17 00:00:00 2001 From: bryan Date: Fri, 4 Oct 2024 00:41:51 -0400 Subject: [PATCH] Remove malformed debs automatically --- installJRMC | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/installJRMC b/installJRMC index 346aa47..0ef8808 100755 --- a/installJRMC +++ b/installJRMC @@ -651,20 +651,27 @@ install_mc_repo() { acquire_deb() { debug "Running: ${FUNCNAME[0]}" - declare -g MC_DEB="$OUTPUT_DIR/SOURCES/MediaCenter-$MC_VERSION-$ARCH.deb" + local fname="MediaCenter-$MC_VERSION-$ARCH.deb" + declare -g MC_DEB="$OUTPUT_DIR/SOURCES/$fname" + debug "MC_DEB=$MC_DEB" # If deb file already exists, skip download if [[ -f $MC_DEB ]]; then - echo "Using existing DEB: $MC_DEB" + if [[ $(stat -c%s "$MC_DEB") -lt 10000000 ]]; then + echo "Removing existing DEB under 10MB: $MC_DEB" + execute rm "$MC_DEB" + else + echo "Using existing DEB: $MC_DEB" + fi return 0 fi # Define the repositories to check local repos=( - "https://files.jriver-cdn.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MC_VERSION-$ARCH.deb" - "https://files.jriver-cdn.com/mediacenter/test/MediaCenter-$MC_VERSION-$ARCH.deb" - "https://files.jriver-cdn.com/mediacenter/channels/v$MVERSION/beta/$BETAPASS/MediaCenter-$MC_VERSION-$ARCH.deb" + "https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/$fname" + "https://files.jriver-cdn.com/mediacenter/test/$fname" + "https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/beta/$BETAPASS/$fname" ) # Loop through the repositories and attempt to download