New functionality: Providing access to host's environmental variables

Last week, systemd checked in a change to provide read-only access to host’s environmental variables as some developers would benefit from changing their functionality based on those variables.

Official interface update is here:

The logic is read-only mount of host os directories:
/etc/os-release -> /run/host/etc/os-release if it exists
/usr/lib/os-release -> /run/host/usr/lib/os-release

containerd seems to be moving in the same direction:

Does that make sense for snapd to have that functionality? If so, I would like to contribute by implementing it in snapd. Disclaimer, I am new to open source contrition by I was able to successfully modify and build snapd.

Any recommendations on which would be the proper function that should have mounting code? Which function should ensure unmounting?


It sounds like the discussion has already started for snapd:RFE: common interface to expose host's os-release to container-like runtimes

"For snaps the non auto-connected interface system-observe already lets a snap access the host os-release under /var/lib/snapd/hostfs/etc/os-release or /var/lib/snapd/hostfs/usr/lib/os-release in the snap mount namespace.

If there is some consensus with container runtimes that this information should be exposed over environment variables a new interface could be added that enables that as well."

Does adding another mapping to have a standard across the industry make sense now since systemd is already doing it?
/etc/os-release -> /run/host/etc/os-release if it exists
/usr/lib/os-release -> /run/host/usr/lib/os-release