diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-29 04:32:43 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-29 04:33:13 +0900 |
| commit | a0b4e47acc228e48165966d8e139277b8f6f450e (patch) | |
| tree | d363a6781536ce946aa445271ca1d3df587e6031 /internal/app/spwayland.go | |
| parent | a52f7038e5a607dd0901244abb791c96deaf9c2d (diff) | |
internal/outcome: rename from app
This is less ambiguous, and more accurately describes the purpose of the package.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/spwayland.go')
| -rw-r--r-- | internal/app/spwayland.go | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/internal/app/spwayland.go b/internal/app/spwayland.go deleted file mode 100644 index d8c18386..00000000 --- a/internal/app/spwayland.go +++ /dev/null @@ -1,63 +0,0 @@ -package app - -import ( - "encoding/gob" - - "hakurei.app/container/check" - "hakurei.app/hst" - "hakurei.app/system/acl" - "hakurei.app/system/wayland" -) - -func init() { gob.Register(new(spWaylandOp)) } - -// spWaylandOp exports the Wayland display server to the container. -// Runs after spRuntimeOp. -type spWaylandOp struct { - // Path to host wayland socket. Populated during toSystem if DirectWayland is true. - SocketPath *check.Absolute -} - -func (s *spWaylandOp) toSystem(state *outcomeStateSys) error { - if state.et&hst.EWayland == 0 { - return errNotEnabled - } - - // outer wayland socket (usually `/run/user/%d/wayland-%d`) - var socketPath *check.Absolute - if name, ok := state.k.lookupEnv(wayland.WaylandDisplay); !ok { - state.msg.Verbose(wayland.WaylandDisplay + " is not set, assuming " + wayland.FallbackName) - socketPath = state.sc.RuntimePath.Append(wayland.FallbackName) - } else if a, err := check.NewAbs(name); err != nil { - socketPath = state.sc.RuntimePath.Append(name) - } else { - socketPath = a - } - - if !state.directWayland { // set up security-context-v1 - appId := state.appId - if appId == "" { - // use instance ID in case app id is not set - appId = "app.hakurei." + state.id.String() - } - // downstream socket paths - state.sys.Wayland(state.instance().Append("wayland"), socketPath, appId, state.id.String()) - } else { // bind mount wayland socket (insecure) - state.msg.Verbose("direct wayland access, PROCEED WITH CAUTION") - state.ensureRuntimeDir() - s.SocketPath = socketPath - state.sys.UpdatePermType(hst.EWayland, socketPath, acl.Read, acl.Write, acl.Execute) - } - return nil -} - -func (s *spWaylandOp) toContainer(state *outcomeStateParams) error { - innerPath := state.runtimeDir.Append(wayland.FallbackName) - state.env[wayland.WaylandDisplay] = wayland.FallbackName - if s.SocketPath == nil { - state.params.Bind(state.instancePath().Append("wayland"), innerPath, 0) - } else { - state.params.Bind(s.SocketPath, innerPath, 0) - } - return nil -} |
