-
Notifications
You must be signed in to change notification settings - Fork 188
[WIP] builtextend: produce a squashfs artifact #261
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
Conversation
This adds support for building a squashfs rootfs image. It can be directly run by `systemd-nspawn` or later assembled into ISO/PXE artifacts.
|
I didn't test this thoroughly, but @dustymabe was interested in it. |
|
yep. will mark WIP for now. I was interested in the steps and this should allow me to look through. Thanks @lucab |
| '-f', 'ext2', | ||
| '-o', f"{vmbuilddir}"]) | ||
|
|
||
| nproc = multiprocessing.cpu_count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| '-drive', f"if=none,id=drive-scsi0-0-0-1,discard=unmap,file={workdir}/cache/cache.qcow2", | ||
| '-device', 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1', | ||
| '-virtfs', f"local,id=workdir,path={workdir},security_model=none,mount_tag=workdir", | ||
| '-serial', 'stdio', '-append', 'root=/dev/sda console=ttyS0 selinux=1 enforcing=0 autorelabel=1']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully a next step after this would be to rewrite runcompose()/runvm() to use this instead.
| vmpreparedir = f"{workdir}/tmp/supermin.prepare" | ||
| if os.path.isdir(vmpreparedir): | ||
| shutil.rmtree(vmpreparedir) | ||
| os.makedirs(vmpreparedir, exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ensure_empty_dir() in cmdlib.py would make sense.
| rpms = [] | ||
| with open(f"{libdir}/vmdeps.txt") as vmdeps: | ||
| for line in vmdeps: | ||
| if not line or line.startswith('#'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd write if line == "" instead of if not line since I have been bitten in the past trying to remember how different languages coerce to booleans.
| script = f'''#!/usr/bin/env bash | ||
| set -xeuo pipefail | ||
| ostree checkout --repo {workdir}/repo/ {ref} /tmp/rootfs | ||
| /sbin/mksquashfs /tmp/rootfs {workdir}/{tmp_img} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a stub right? The commit description says it's bootable this won't do that AFAICS.
This whole concept kind of depends on us reworking to use not-anaconda right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no.
This a basic ostree->squashfs conversion, and the resulting artifact can already be run by systemd-nspawn --volatile --boot (I wouldn't say it's bootable, as it doesn't contain any bootloader). No very interesting per se, but (possibly) an intermediate step towards re-using this rootfs for embeddeding in live PXE/ISO artifacts.
In that regard, this flow is already bypassing anaconda. It consumes an ostree ref and runs this build-extending script in a supermin VM.
|
(Overall, excellent code!) |
|
#738 is intended to supersede this. |
|
@bgilbert thanks for taking it over. Should we close this one then? Or is there an interest in publishing rootfs-as-squashfs on its own? (I thought I filed a ticket to track the latter question, but I'm not finding it right now) |
|
Let's close this, I think. We can always wrap a |
This adds support for building a squashfs rootfs image. It can be
directly run by
systemd-nspawnor later assembled into ISO/PXEartifacts.