snapenv

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package snapenv adapts RemoHop to running from its snap package (packaging/snap). The snap uses classic confinement, so the program sees the system as any other install does; two things still differ, and both are handled here:

  • `snap run` adds SNAP, SNAP_NAME, SNAP_REVISION and a dozen other SNAP_* variables to the environment. Every process the host starts inherits that environment (remote shells, xdg-open, screen capture helpers), and programs that see SNAP believe they run inside a snap themselves (GTK and Electron apps switch to portals, scripts change paths). Setup removes them, so a remote shell gets the user's real environment, as with the other packages.
  • The program lives in /snap/<name>/<revision>/, a directory that is deleted a few refreshes later. StableExe turns such a path into /snap/<name>/current/..., which snapd points at every new revision, for files that outlive this process (the systemd unit of `remohop service install`).

Outside a snap both are no-ops, and so is everything on systems other than Linux, where snaps do not exist.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup()

Setup records whether this process runs from a snap and, if so, removes snapd's variables from its environment. Call it once, before anything starts a child process. A SNAP variable that does not name the directory this binary runs from (one leaked from another snap's terminal, say) is left alone.

func StableExe

func StableExe(exe string) string

StableExe returns exe with the snap's revision directory replaced by its "current" link, when exe is inside the snap this process runs from; otherwise exe unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL