Skip to content

Commit

Permalink
virt/incus: Use fakeroot for image build to retain rootfs ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
theCalcaholic authored and paralin committed Sep 28, 2024
1 parent 40b7e6f commit 7e23644
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion configs/virt/incus/extensions/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildimage:
@$(SKIFF_CURRENT_CONF_DIR)/scripts/buildimage.sh
@FAKEROOTDONTTRYCHOWN=1 ${BUILDROOT_DIR}/host/bin/fakeroot -- $(SKIFF_CURRENT_CONF_DIR)/scripts/buildimage.sh
run:
@$(SKIFF_CURRENT_CONF_DIR)/scripts/run.sh
exec:
Expand Down
7 changes: 2 additions & 5 deletions configs/virt/incus/scripts/buildimage.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/bin/bash
set -eu

IMAGE_NAME=skiffos/testing
CONTAINER=skiff
OUTPUT_PATH="$BUILDROOT_DIR/output"
IMAGES_PATH="$BUILDROOT_DIR/images"
INCUS_IMAGE_PATH="${IMAGES_PATH}/incus.tar.gz"
roottar="${IMAGES_PATH}/rootfs.tar"

TMPDIR="${BUILDROOT_DIR}/incus-tmp"
trap 'rm -rf "$TMPDIR";' EXIT
rm -rf "$TMPDIR"
trap 'rm -rf "$TMPDIR";' EXIT
mkdir -p "${TMPDIR}/rootfs"
tar -xf "$roottar" -C "$TMPDIR/rootfs"
pushd "$TMPDIR"
Expand All @@ -25,4 +22,4 @@ echo "${INCUS_METADATA:-"${default_metadata}"}" >"${TMPDIR}/metadata.yaml"
tar caf "${INCUS_IMAGE_PATH}" rootfs metadata.yaml
popd

echo "Incus image generated successfully as ${IMAGE_NAME}"
echo "Incus image generated successfully at ${INCUS_IMAGE_PATH}"

0 comments on commit 7e23644

Please sign in to comment.