cirros-dev / cirros

120 stars 33 forks source link

Add injection for /etc/os-release file #85

Closed NucciTheBoss closed 2 years ago

NucciTheBoss commented 2 years ago

Dynamically generate /etc/os-release using a here document in bin/build-release. This way we can grab verison_id, kernel, grub, and buildroot. Also makes it easier to administrate CirrOS images/locate where to report bugs. Example output:

$ cat /etc/os-release
PRETTY_NAME="CirrOS d220803"
NAME="CirrOS"
VERSION_ID="d220803"
ID=cirros
HOME_URL="https://github.com/cirros-dev/cirros"
BUG_REPORT_URL="https://github.com/cirros-dev/cirros/issues"
BUILDROOT_VERSION="2019.02.1"
KERNEL_VERSION="5.3.0-26.28~18.04.1"
GRUB_VERSION="2.02-2ubuntu8.14"

Closes #79

hrw commented 2 years ago

I like it

smoser commented 2 years ago

one other comment.

cirros's "disk images" are just disk images with an empty filesystem labelled "cirros-rootfs" (from ROOTFS_LABEL in /init). The kernel and initramfs then copy/"install" themselves to the filesystem (/init lines 57-77).

I just had the thought that it might be nice if these filesystem images had a '/etc/os-release' file so that if some thing went looking it would find that.

So in /init lines 57-77 you'd have to amend the "install" to account for an existing /etc/os-release (easiest way to do that would be just to remove it).

I'm fine if you don't do that in this PR (its probalby better if you do not). But If you wanted to poke around cirros a bit more, that'd be something to do.

Again, thanks!

NucciTheBoss commented 2 years ago

I'm fine if you don't do that in this PR (its probalby better if you do not). But If you wanted to poke around cirros a bit more, that'd be something to do.

More info for the end-user the better! I'll keep this pull request focused on adding /etc/os-release to the built images, but I will look into following up with a separate pull request that adds /etc/os-release to the filesystem images too :smile:

hrw commented 2 years ago

@NucciTheBoss can you rebase and finish patch?

Would be great to have proper /etc/os-release in 0.6.0 release.

NucciTheBoss commented 2 years ago

@hrw Sorry about my absence, got caught up in a terminal UI and CI project that took up most of my time for the past month. Project wrapped up earlier this week so I can breathe again.

I will get this out tonight/tomorrow.

hrw commented 2 years ago

Can you squash and rebase those changes?

NucciTheBoss commented 2 years ago

Can you squash and rebase those changes?

I think you can squash this pull request if you merge it (I believe it is a selectable drop down on the merge button), but I will try to flatten the commit into a single one.

NucciTheBoss commented 2 years ago

Well that's not what I wanted

NucciTheBoss commented 2 years ago

Going to close out the pull request and submit a new one. Rebase got messed up. I tried to squash the commits by changing the order, but it looks that it included all the other commits as well.