diff --git a/samples/base-qcow2.json b/samples/base-qcow2.json index 69ecf13d..dba08655 100644 --- a/samples/base-qcow2.json +++ b/samples/base-qcow2.json @@ -53,12 +53,6 @@ "kernel_opts": "ro biosdevname=0 net.ifnames=0" } }, - { - "name": "org.osbuild.debug-shell", - "options": { - "tty": "/dev/ttyS0" - } - }, { "name": "org.osbuild.selinux", "options": { diff --git a/samples/base-test.json b/samples/base-test.json new file mode 100644 index 00000000..920c213e --- /dev/null +++ b/samples/base-test.json @@ -0,0 +1,80 @@ +{ + "name": "base-qcow2", + "stages": [ + { + "name": "org.osbuild.dnf", + "options": { + "releasever": "30", + "install_weak_deps": true, + "repos": { + "fedora": { + "name": "Fedora", + "metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch", + "gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch" + } + }, + "packages": [ + "@Core", + "chrony", + "kernel", + "selinux-policy-targeted", + "grub2-pc", + "spice-vdagent", + "qemu-guest-agent", + "xen-libs", + "langpacks-en" + ] + } + }, + { + "name": "org.osbuild.locale", + "options": { + "language": "en_US" + } + }, + { + "name": "org.osbuild.fstab", + "options": { + "filesystems": [ + { + "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", + "vfs_type": "ext4", + "path": "/", + "freq": "1", + "passno": "1" + } + ] + } + }, + { + "name": "org.osbuild.grub2", + "options": { + "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", + "kernel_opts": "ro biosdevname=0 net.ifnames=0" + } + }, + { + "name": "org.osbuild.test", + "options": { + "script": "/usr/bin/systemctl is-system-running --wait" + } + }, + { + "name": "org.osbuild.selinux", + "options": { + "file_contexts": "etc/selinux/targeted/contexts/files/file_contexts" + } + }, + { + "name": "org.osbuild.fix-bls" + } + ], + "assembler": + { + "name": "org.osbuild.qcow2", + "options": { + "filename": "base.qcow2", + "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac" + } + } +} diff --git a/stages/org.osbuild.test b/stages/org.osbuild.test new file mode 100755 index 00000000..307c3b5c --- /dev/null +++ b/stages/org.osbuild.test @@ -0,0 +1,34 @@ +#!/usr/bin/python3 + +import json +import os +import sys + + +def main(tree, options): + script = options["script"] + + unit = f""" +[Unit] +Description=Boot Test +Wants=dev-vport0p1.device +After=dev-vport0p1.device + +[Service] +StandardOutput=file:/dev/vport0p1 +ExecStart={script} +ExecStopPost=/usr/bin/systemctl poweroff +""" + with open(f"{tree}/etc/systemd/system/osbuild-test.service", "w") as f: + f.write(unit) + + os.symlink("../osbuild-test.service", + f"{tree}/etc/systemd/system/multi-user.target.wants/osbuild-test.service") + + return 0 + + +if __name__ == '__main__': + args = json.load(sys.stdin) + r = main(args["tree"], args["options"]) + sys.exit(r)