WebThingsIO / gateway

WebThings Gateway - a self-hosted web application for monitoring and controlling a building over the web
http://webthings.io/gateway
Mozilla Public License 2.0
2.62k stars 339 forks source link

Detect if running inside a snap or on Ubuntu Core #3165

Closed benfrancis closed 1 month ago

benfrancis commented 2 months ago

This is the first step in porting WebThings Gateway to Ubuntu Core.

Ubuntu Core does not ship with the lsb_release command so we have to add some snap-specific code to check for the existence of a distro ID in /var/lib/snapd/hostfs/etc/os-release, which relates to the host OS. See https://forum.snapcraft.io/t/hosts-lsb-release-but-core-os-release/24351/4

benfrancis commented 2 months ago

@ogra1 Is this the cleanest way of doing this?

dilyn-corner commented 1 month ago

Yes, using the system-observe interface is indeed the best way for a snap to know what the actual host environment is.