You can also check environment variables and the .flatpak-info file in the root fs of the container to determine if it's a flatpak. Other sandboxing engines may use the same runtime as flatpak.
Additionally, the os-release may change if the underlying runtime changes from, say, freedesktop to KDE or GNOME for whatever reason.
It's a bit more involved than just parsing os-release, but likely only an extra three lines of code of insignificance.
You can also check environment variables and the .flatpak-info file in the root fs of the container to determine if it's a flatpak. Other sandboxing engines may use the same runtime as flatpak.
I don't know if the container has access to the .flatpak-info file. If it does, then that's fine too.
Additionally, the os-release may change if the underlying runtime changes from, say, freedesktop to KDE or GNOME for whatever reason.
I think it's unlikely, but if that happens, we could also check for the presence of ID_LIKE in the same file:
From a software development and support perspective, using Flatpak is a replacement of the underlying distro with no considerations to what that might be. This statistic is not a valuable addition.
Nothing extracted yet.
Currently, in the Steam Flatpak package (which is unofficial), the Flatpak package format gets reported as "Freedesktop SDK" in the HW survey.
However, that is because the
/etc/os-releasefile inside the Flatpak reports that information.The host's
/etc/os-releasefile is available for all Flatpaks; see here.My request is to detect the underlying distribution using the Flatpak to be shown in the stats, and not the Flatpak itself.
"But the underlying distribution doesn't matter, since the libraries used are those from the Flatpak."
That is correct, but knowing the distro would also be useful in terms of popularity. For example: are Fedora and OpenSUSE Atomic variants getting popular within gamers? We can't know what if we only have the basic info from the Flatpak.
What could be done is the following:
The numbers are made-up; it's just an idea of how it could be done.
Then, the Freedesktop list item (as if it was a normal distribution) would be removed, and its percentages would be distributed according to the base operating system.
This way we can know more of which distributions are being used rather than if such distros are just using the Flatpak.
For this to work, work would have to be done in the Steam side, but it should be pretty simple:
/etc/os-release.NAME="Freedesktop SDK"is reported./run/host/os-release.PRETTY_NAME, as that's how it works now).From what I could gather, this isn't something the Steam Flatpak could do. Even if something was done in the Steam Flatpak's side, what would result is the
/etc/os-releasefrom Flatpak getting overriden by/run/host/os-release, which would simply remove the percentage of users using Flatpak altogether, which is not desirable, since we want to know that information, in addition to the base distro.Thanks.