Optionally, patch /etc/os-release automatically
I think it would make sense to optionally patch /etc/os-release. Specifically, I think it would make sense to havea new setting
PatchOsRelease=image|build|no
or so, with a default of "no".
If PatchOSRelease=image is set we'd use ImageVersion= and ImageId, then read patch it into IMAGE_VERSION + IMAGE_ID in /etc/os-release.
If PatchOSRelease=build is set, we'd instead write the combination of both into BUILD_ID, and if neither is set, make up a build Id from the calendar time.
Why the two distinct modes? This reflects two different usecases I see for images. IMAGE_VERSION/IMAGE_ID is what should be used when disk images are eventually updated in atomic fashion, and BUILD_ID is what should be used when updates happen via a traditional package manager. i.e. depending on whether every update is built via mkosi too, or whether updates are done via another tool we want a different property. Also see the docs for these fields in the man page of os-release.
And I figure we should patch /etc/os-release when building UsrOnly=no, and /usr/lib/os-release if UsrOnly=yes.
If we do this, it should also support PatchOsRelease=sysext, for #802.
We do at least IMAGE_VERSION / IMAGE_ID by default now when set. Let's do the others via separate RFEs