From f1d14428d11a562a537942bc6e2fed8bcea60a70 Mon Sep 17 00:00:00 2001 From: R0flcopt3r <12752060+R0flcopt3r@users.noreply.github.com> Date: Sun, 16 Mar 2025 18:33:49 +0100 Subject: fix: _rootful_load_image would not copy if the user image was different (#88) Co-authored-by: Eirik O. Lavik --- Justfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Justfile b/Justfile index ff51345..f12166c 100644 --- a/Justfile +++ b/Justfile @@ -157,11 +157,13 @@ _rootful_load_image $target_image=image_name $tag=default_tag: return_code=$? set -e + USER_IMG_ID=$(podman images --filter reference="${target_image}:${tag}" --format "'{{ '{{.ID}}' }}'") + if [[ $return_code -eq 0 ]]; then # If the image is found, load it into rootful podman ID=$(just sudoif podman images --filter reference="${target_image}:${tag}" --format "'{{ '{{.ID}}' }}'") - if [[ -z "$ID" ]]; then - # If the image ID is not found, copy the image from user podman to root podman + if [[ "$ID" != "$USER_IMG_ID" ]]; then + # If the image ID is not found or different from user, copy the image from user podman to root podman COPYTMP=$(mktemp -p "${PWD}" -d -t _build_podman_scp.XXXXXXXXXX) just sudoif TMPDIR=${COPYTMP} podman image scp ${UID}@localhost::"${target_image}:${tag}" root@localhost::"${target_image}:${tag}" rm -rf "${COPYTMP}" -- cgit v1.2.3