Skip to content

examples: add bootc/ directory #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions examples/bootc/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

set -eux

cd "${0%/*}"
image="${1:-docker://quay.io/fedora/fedora-bootc:42}"

cargo build --release
cp ../../target/release/cfsctl .
mkdir -p initrd/usr/bin
cp ../../target/release/composefs-setup-root initrd/usr/bin

# rm -rf tmp
../common/install-systemd-boot

mkdir -p tmp/sysroot/composefs
./cfsctl --repo tmp/sysroot/composefs oci pull "${image}" image
./cfsctl --repo tmp/sysroot/composefs oci prepare-boot refs/image --bootdir tmp/efi --cmdline rw --cmdline console=ttyS0,115200 --cmdline enforcing=0 --cmdline root=/dev/vda2 --entry-id example

(
cd initrd
find -print0 | cpio --null -ov --format=newc
) | gzip -9 > tmp/efi/composefs-setup-root.img

echo 'initrd /composefs-setup-root.img' >> tmp/efi/loader/entries/example.conf

../common/make-image bootc-efi.qcow2
1 change: 1 addition & 0 deletions examples/bootc/initrd/usr/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/composefs-setup-root
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (C) 2013 Colin Walters <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <https://www.gnu.org/licenses/>.

[Unit]
DefaultDependencies=no
ConditionKernelCommandLine=composefs
ConditionPathExists=/etc/initrd-release
After=sysroot.mount
Requires=sysroot.mount
Before=initrd-root-fs.target
Before=initrd-switch-root.target

OnFailure=emergency.target
OnFailureJobMode=isolate

[Service]
Type=oneshot
ExecStart=/usr/bin/composefs-setup-root
StandardInput=null
StandardOutput=journal
StandardError=journal+console
RemainAfterExit=yes
2 changes: 1 addition & 1 deletion src/bin/composefs-setup-root.rs
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ struct Args {

#[arg(
long,
default_value = "/usr/lib/ostree/prepare-root.conf",
default_value = "/usr/lib/composefs/setup-root.conf",
help = "Config path (for testing)"
)]
config: PathBuf,