| 
 | 1 | +FROM quay.io/fedora/fedora-bootc:42  | 
 | 2 | +COPY . /  | 
 | 3 | + | 
 | 4 | +RUN <<EOF  | 
 | 5 | +set -euxo pipefail  | 
 | 6 | + | 
 | 7 | +# Disable root password for debug/testing/demos  | 
 | 8 | +passwd -d root  | 
 | 9 | + | 
 | 10 | +if [[ "$(grep -c "VARIANT=\"CoreOS\"" /etc/os-release)" -eq 1 ]]; then  | 
 | 11 | +    # Disable some units that currently don't work for us  | 
 | 12 | +    sed -i 's/enable coreos-warn-invalid-mounts.service//' \  | 
 | 13 | +        /usr/lib/systemd/system-preset/45-fcos.preset  | 
 | 14 | +    sed -i 's/enable coreos-populate-lvmdevices.service//' \  | 
 | 15 | +        /usr/lib/systemd/system-preset/45-coreos-populate-lvmdevices.preset  | 
 | 16 | + | 
 | 17 | +    # Fix dependencies  | 
 | 18 | +    sed -i 's|ExecStart=/usr/sbin/coreos-boot-edit|ExecStart=true|' \  | 
 | 19 | +        /usr/lib/dracut/modules.d/35coreos-ignition/coreos-boot-edit.service  | 
 | 20 | +    sed -i 's|ExecStart=/usr/bin/rdcore verify-unique-fs-label --rereadpt boot|ExecStart=true|' \  | 
 | 21 | +        /usr/lib/dracut/modules.d/35coreos-ignition/coreos-ignition-unique-boot.service   | 
 | 22 | + | 
 | 23 | +    sed -i 's/ConditionKernelCommandLine=ostree/ConditionKernelCommandLine=composefs/' \  | 
 | 24 | +        /usr/lib/dracut/modules.d/40ignition-ostree/*  | 
 | 25 | +    sed -i 's/After=ostree-prepare-root.service/After=bootc-initramfs-setup.service/' \  | 
 | 26 | +        /usr/lib/dracut/modules.d/40ignition-ostree/*  | 
 | 27 | +    sed -i 's/Requires=ostree-prepare-root.service/Requires=bootc-initramfs-setup.service/' \  | 
 | 28 | +        /usr/lib/dracut/modules.d/40ignition-ostree/*  | 
 | 29 | + | 
 | 30 | +    sed -i '/Type=oneshot/a ExecStart=bash -c "udevadm settle; sleep 1"' \  | 
 | 31 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-growfs.service  | 
 | 32 | + | 
 | 33 | +    sed -i 's|ExecStart=/usr/sbin/ignition-ostree-mount-var mount|ExecStart=true|' \  | 
 | 34 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-mount-var.service  | 
 | 35 | +    sed -i 's|ExecStop=/usr/sbin/ignition-ostree-mount-var umount|ExecStart=true|' \  | 
 | 36 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-mount-var.service  | 
 | 37 | + | 
 | 38 | +    sed -i 's|ExecStart=/usr/sbin/ignition-ostree-firstboot-uuid boot|ExecStart=true|' \  | 
 | 39 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-uuid-boot.service  | 
 | 40 | +    sed -i 's|ExecStart=/usr/sbin/ignition-ostree-firstboot-uuid root|ExecStart=true|' \  | 
 | 41 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-uuid-root.service  | 
 | 42 | + | 
 | 43 | +    sed -i 's/find/find fsverity/' \  | 
 | 44 | +        /usr/lib/dracut/modules.d/40ignition-ostree/module-setup.sh  | 
 | 45 | + | 
 | 46 | +    sed -i 's|chcon -v --reference "${saved_root}" /sysroot  # the root of the fs itself|chcon -v system_u:object_r:root_t:s0 /sysroot  # the root of the fs itself|' \  | 
 | 47 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-transposefs.sh  | 
 | 48 | +    sed -i '/chattr +i/d' \  | 
 | 49 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-transposefs.sh  | 
 | 50 | +    sed -i '/chcon -v system_u:object_r:root_t:s0 \/sysroot  # the root of the fs itself/a echo "Enabling fs-verity again..."' \  | 
 | 51 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-transposefs.sh  | 
 | 52 | +    sed -i '/echo "Enabling fs-verity again..."/a find /sysroot/composefs/objects -type f -exec fsverity enable {} \\;' \  | 
 | 53 | +        /usr/lib/dracut/modules.d/40ignition-ostree/ignition-ostree-transposefs.sh  | 
 | 54 | + | 
 | 55 | +    # We don't want openh264  | 
 | 56 | +    rm -f "/etc/yum.repos.d/fedora-cisco-openh264.repo"  | 
 | 57 | + | 
 | 58 | +    # Install fsverity utils to re-enable fsverity on repo objects after  | 
 | 59 | +    # transposefs step when reprovisionning the root disk  | 
 | 60 | +    dnf install -y fsverity-utils  | 
 | 61 | +fi  | 
 | 62 | +EOF  | 
 | 63 | + | 
 | 64 | +# need to have bootc-initramfs-setup in the initramfs so we need this  | 
 | 65 | +RUN set -x; \  | 
 | 66 | +    kver=$(cd /usr/lib/modules && echo *); \  | 
 | 67 | +    dracut -vf --install "/etc/passwd /etc/group" /usr/lib/modules/$kver/initramfs.img $kver;  | 
0 commit comments