internal/outcome: populate instance metadata for PipeWire
All checks were successful
Test / Create distribution (push) Successful in 1m10s
Test / Hakurei (push) Successful in 12m25s
Test / Sandbox (push) Successful in 1m40s
Test / Sandbox (race detector) (push) Successful in 2m29s
Test / Hakurei (race detector) (push) Successful in 4m54s
Test / Hpkg (push) Successful in 3m56s
Test / Flake checks (push) Successful in 2m42s
All checks were successful
Test / Create distribution (push) Successful in 1m10s
Test / Hakurei (push) Successful in 12m25s
Test / Sandbox (push) Successful in 1m40s
Test / Sandbox (race detector) (push) Successful in 2m29s
Test / Hakurei (race detector) (push) Successful in 4m54s
Test / Hpkg (push) Successful in 3m56s
Test / Flake checks (push) Successful in 2m42s
These have similar semantics to equivalent Wayland security-context-v1 fields. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -14,8 +14,8 @@ import (
|
||||
// PipeWire maintains a pipewire socket with SecurityContext attached via [pipewire].
|
||||
// The socket stops accepting connections once the pipe referred to by sync is closed.
|
||||
// The socket is pathname only and is destroyed on revert.
|
||||
func (sys *I) PipeWire(dst *check.Absolute) *I {
|
||||
sys.ops = append(sys.ops, &pipewireOp{nil, dst})
|
||||
func (sys *I) PipeWire(dst *check.Absolute, appID, instanceID string) *I {
|
||||
sys.ops = append(sys.ops, &pipewireOp{nil, dst, appID, instanceID})
|
||||
return sys
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ func (sys *I) PipeWire(dst *check.Absolute) *I {
|
||||
type pipewireOp struct {
|
||||
scc io.Closer
|
||||
dst *check.Absolute
|
||||
|
||||
appID, instanceID string
|
||||
}
|
||||
|
||||
func (p *pipewireOp) Type() hst.Enablement { return Process }
|
||||
@@ -56,6 +58,8 @@ func (p *pipewireOp) apply(sys *I) (err error) {
|
||||
|
||||
if p.scc, err = securityContext.BindAndCreate(p.dst.String(), pipewire.SPADict{
|
||||
{Key: pipewire.PW_KEY_SEC_ENGINE, Value: "app.hakurei"},
|
||||
{Key: pipewire.PW_KEY_SEC_APP_ID, Value: p.appID},
|
||||
{Key: pipewire.PW_KEY_SEC_INSTANCE_ID, Value: p.instanceID},
|
||||
{Key: pipewire.PW_KEY_ACCESS, Value: "restricted"},
|
||||
}); err != nil {
|
||||
return newOpError("pipewire", err, false)
|
||||
@@ -92,7 +96,9 @@ func (p *pipewireOp) revert(sys *I, _ *Criteria) error {
|
||||
func (p *pipewireOp) Is(o Op) bool {
|
||||
target, ok := o.(*pipewireOp)
|
||||
return ok && p != nil && target != nil &&
|
||||
p.dst.Is(target.dst)
|
||||
p.dst.Is(target.dst) &&
|
||||
p.appID == target.appID &&
|
||||
p.instanceID == target.instanceID
|
||||
}
|
||||
|
||||
func (p *pipewireOp) Path() string { return p.dst.String() }
|
||||
|
||||
Reference in New Issue
Block a user