Classic Confinement for wtfutil

Thank you for the additional details!

This could be handled by home and removable-media (and possibly personal-files depending on the use of $HOME wrt .git and .hg). You would stage-package git and mercurial.

This would need a new interface or an adjustment to an existing one, perhaps system-observe.

You might want to parse /etc/lsb-release directly, though you might be able to get away with staging lsb-release.

You can stage network-manager and plugs the network-manager interface.

You can stage ufw and plugs the firewall-control interface.

You stage upower and plugs upower-observe.

I’m unfamiliar with this command and command-not-found isn’t helping me. You would need to ship this in your snap but googling suggests it is OS X specific.

The snap developer declares what interfaces should be used by the snap, not the user. Some interfaces are manually connected, some auto-connected. We have a process for requesting auto-connection such that when granted your users need only ‘snap install wtfutil’ and everything works.

You would need to change things a little bit since snaps aren’t allowed to call sudo directly. Users could either invoke wtfutil with sudo, or you can create a daemon in your snap that listens on a socket which can run these commands. wtfutil then talks to this daemon over the socket instead of calling ufw/etc directly. You would want to put some mechanisms in place in the daemon to perhaps verify the connecting process’ uid, lookup the supplementary groups and verify it is in an approved list so as not to allow arbitrary processes to talk to your snap and run the commands. Other options are possible.

In summary, snapd supports everything you listed (except who, which I’ve taken a todo to add to snapd 2.43 (the next release)). It will take a bit of work to convert it over, but each of the commands you gave is something other snap developers have done (again, except who).

When developing your strict mode snap, you might be interested in snappy-debug. It will provide suggestions for things to plug as your snap is running. Good luck and feel free to ask questions in the snapcraft category.