Skip to content

Commit 1e0f609

Browse files
dmnksffesti
authored andcommitted
Populate DESTDIR separately on image build
This simplifies the code and, more importantly, allows one to run "make check" inside a toolbox container, assuming that it has a podman shim installed that runs "flatpak-spawn --host podman" [*]. That previously didn't work correctly because the "podman unshare" call (needed for "podman mount" to work) caused make_install() to run on the *host*, defeating the purpose of using a toolbox in the first place. [*] https://docs.fedoraproject.org/en-US/fedora-silverblue/tips-and-tricks/
1 parent 152e748 commit 1e0f609

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/mktree.oci

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ else
2525
FROM=
2626
fi
2727

28+
DEST_DIR="$PWD/mktree.destdir"
2829
CACHE_DIR="mktree.cache"
2930
IID_FILE="$CACHE_DIR/image-id"
3031
IMAGE_ID=$(cat $IID_FILE 2>/dev/null || echo "")
@@ -68,15 +69,8 @@ clean()
6869
$PODMAN rmi $IMAGE_ID >/dev/null
6970
}
7071

71-
unshared()
72-
{
73-
[ $(id -u) != 0 ] && [ $NATIVE == yes ] || return 0
74-
$PODMAN unshare $0 $CMD "$@"
75-
exit
76-
}
77-
7872
case $CMD in
79-
build) unshared
73+
build)
8074
# Build base image
8175
$PODMAN build --target base -t $BASE_TAG $ARGS
8276

@@ -87,7 +81,9 @@ case $CMD in
8781
id=$($PODMAN create -t $BASE_TAG)
8882
trap "$PODMAN kill $id >/dev/null; $PODMAN rm $id > /dev/null" EXIT
8983
$PODMAN start $id
90-
make_install $($PODMAN mount $id)
84+
rm -rf "$DEST_DIR"
85+
make_install $DEST_DIR
86+
$PODMAN cp $DEST_DIR/. $id:/
9187
$PODMAN exec $id /usr/share/mktree/setup.sh
9288
$PODMAN commit -q $id --iidfile=$IID_FILE
9389
else

0 commit comments

Comments
 (0)