Create temp deb for _apt

This commit is contained in:
2025-04-24 19:28:31 -04:00
parent b960867a0a
commit 8387813dc8

View File

@@ -711,9 +711,9 @@ acquire_deb() {
fi fi
# Download the deb file using the containerized package manager # Download the deb file using the containerized package manager
if ! { create_mc_apt_container "cd /tmp && apt-get -t $MC_REPO download --allow-unauthenticated mediacenter$MC_MVERSION &>/dev/null" && if ! { create_mc_apt_container "apt-get -t $MC_REPO download --allow-unauthenticated mediacenter$MC_MVERSION &>/dev/null" &&
mnt="$(sudo buildah mount "$CNT")" && mnt="$(sudo buildah mount "$CNT")" &&
execute sudo find "$mnt/tmp" -maxdepth 1 -type f -name "*.deb" -exec cp {} "$MC_DEB" \; && execute sudo find "$mnt" -maxdepth 1 -type f -name "*.deb" -exec cp {} "$MC_DEB" \; &&
[[ -f $MC_DEB ]] && [[ -f $MC_DEB ]] &&
execute sudo chown "_apt:$USER" "$MC_DEB" && execute sudo chown "_apt:$USER" "$MC_DEB" &&
execute sudo buildah umount "$CNT" && execute sudo buildah umount "$CNT" &&
@@ -980,21 +980,29 @@ install_mc_deb() {
fi fi
fi fi
# Copy the DEB to a temporary file so _apt can read it
debug "Creating temporary deb file owned byq _apt"
local temp_deb
temp_deb=$(mktemp)
execute sudo cp "$MC_DEB" "$temp_deb"
execute sudo chown _apt "$temp_deb"
# Use --reinstall to make sure local package is installed over repo package # Use --reinstall to make sure local package is installed over repo package
if ! install_package \ if ! install_package \
--no-install-check \ --no-install-check \
--no-gpg-check \ --no-gpg-check \
--allow-downgrades \ --allow-downgrades \
--reinstall \ --reinstall \
"$MC_DEB"; then "$temp_deb"; then
err "Local MC DEB installation failed" err "Local MC DEB installation failed"
((remove_jammy)) && { echo "Removing jammy repo"; execute sudo rm -f "$repo_file"; } ((remove_jammy)) && { echo "Removing jammy repo"; execute sudo rm -f "$repo_file"; }
if ask_ok "Remove source DEB and retry"; then if ask_ok "Remove source DEB and retry"; then
execute rm -f "$MC_DEB" execute rm -f "$MC_DEB" "$temp_deb"
exec "$SCRIPT_PATH" "$@" "--no-update" exec "$SCRIPT_PATH" "$@" "--no-update"
fi fi
fi fi
((remove_jammy)) && { echo "Removing jammy repo"; execute sudo rm -f "$repo_file"; } ((remove_jammy)) && { echo "Removing jammy repo"; execute sudo rm -f "$repo_file"; }
execute rm -f "$temp_deb"
} }
# @description Installs MC via RPM package # @description Installs MC via RPM package