#!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later set -e image_name=$1 # monkey-patch loopdev partition detection, given we're not running systemd # (bootc runs `udevadm settle` as a way to wait until loopdev partitions are # detected; we hijack that call and use partx to set up the partition devices) original_udevadm=$( which udevadm ) mkdir -p /output/bin cat >/output/bin/udevadm </usr/lib/bootc/install/00-crun-vm.toml <<-EOF [install.filesystem.root] type = "xfs" EOF fi # build disk image using bootc-install # TODO: `bootc install to-disk` currently fails when using docker-archive. Fix # the underlying issue to avoid this skopeo-copy command. skopeo copy --quiet \ docker-archive:/output/image.docker-archive \ oci-archive:/output/image.oci-archive rm /output/image.docker-archive PATH=/output/bin:$PATH bootc install to-disk \ --source-imgref oci-archive:/output/image.oci-archive \ --target-imgref "$image_name" \ --skip-fetch-check \ --generic-image \ --via-loopback \ --karg console=tty0 \ --karg console=ttyS0 \ --karg selinux=0 \ /output/image.raw # communicate success by creating a file, since krun always exits successfully touch /output/bootc-install-success