ran
April 22, 2021, 6:29am
1
Hi there.
I’m using Matomo in an Electron app to keep track on how many installations this app got and how the versions spread. What I would like to know as well is, from what sources these apps have been installed. Or in other words in which containers they run on the users side.
I would basically need an identifier in my apps main process, that for instance is set during build.
I can already identify if the app is run as an AppImage (through an ENV that is only set by AppImage), as a Windows Store app (https://www.electronjs.org/docs/api/process#processwindowsstore-readonly ) or a Mac App Store build (https://www.electronjs.org/docs/api/process#processmas-readonly ).
But so far I haven’t found a way to properly identify a Snap. Do you guys have any idea how I would do that?
ogra
April 22, 2021, 6:53am
2
pick one (i usually check if $SNAP is set when i need this):
$ snap run --shell htop.htop -c env |grep SNAP
SNAP_REVISION=2185
SNAP_REAL_HOME=/home/ogra
SNAP_USER_COMMON=/home/ogra/snap/htop/common
SNAP_INSTANCE_KEY=
SNAP_CONTEXT=YjYHdhDv0DrDkWsVXBhTXwMCV4NB9xmDj6SB5MBNVqdg
SNAP_ARCH=amd64
SNAP_INSTANCE_NAME=htop
SNAP_USER_DATA=/home/ogra/snap/htop/2185
SNAP_REEXEC=
SNAP=/snap/htop/2185
SNAP_COMMON=/var/snap/htop/common
SNAP_VERSION=3.0.5
SNAP_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void
SNAP_COOKIE=YjYHdhDv0DrDkWsVXBhTXwMCV4NB9xmDj6SB5MBNVqdg
SNAP_DATA=/var/snap/htop/2185
SNAP_NAME=htop
1 Like
ran
April 22, 2021, 7:15am
3
Ah ok, that’s easy, I’ll give it a try, let’s see if it works.
ran
April 22, 2021, 11:45am
4
Worked perfectly well, thanks again!
1 Like