From eb22a8bcc1ac03357d4073e5d3ed6d0ab5246a37 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 2 Jul 2025 20:42:51 +0900 Subject: cmd/hakurei: move to cmd Having it at the project root never made sense since the "ego" name was deprecated. This change finally addresses it. Signed-off-by: Ophestra --- internal/sys/interface.go | 9 +++++---- internal/sys/std.go | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'internal/sys') diff --git a/internal/sys/interface.go b/internal/sys/interface.go index 57c5a7ec..06cb450c 100644 --- a/internal/sys/interface.go +++ b/internal/sys/interface.go @@ -1,3 +1,4 @@ +// Package sys wraps OS interaction library functions. package sys import ( @@ -6,7 +7,7 @@ import ( "path" "strconv" - "git.gensokyo.uk/security/hakurei/internal/app" + "git.gensokyo.uk/security/hakurei/hst" "git.gensokyo.uk/security/hakurei/internal/hlog" ) @@ -40,15 +41,15 @@ type State interface { Println(v ...any) Printf(format string, v ...any) - // Paths returns a populated [Paths] struct. - Paths() app.Paths + // Paths returns a populated [hst.Paths] struct. + Paths() hst.Paths // Uid invokes hsu and returns target uid. // Any errors returned by Uid is already wrapped [fmsg.BaseError]. Uid(aid int) (int, error) } // CopyPaths is a generic implementation of [hst.Paths]. -func CopyPaths(os State, v *app.Paths) { +func CopyPaths(os State, v *hst.Paths) { v.SharePath = path.Join(os.TempDir(), "hakurei."+strconv.Itoa(os.Getuid())) hlog.Verbosef("process share directory at %q", v.SharePath) diff --git a/internal/sys/std.go b/internal/sys/std.go index 6db4bae2..c3913a75 100644 --- a/internal/sys/std.go +++ b/internal/sys/std.go @@ -12,15 +12,15 @@ import ( "sync" "syscall" + "git.gensokyo.uk/security/hakurei/hst" "git.gensokyo.uk/security/hakurei/internal" - "git.gensokyo.uk/security/hakurei/internal/app" "git.gensokyo.uk/security/hakurei/internal/hlog" "git.gensokyo.uk/security/hakurei/sandbox" ) // Std implements System using the standard library. type Std struct { - paths app.Paths + paths hst.Paths pathsOnce sync.Once uidOnce sync.Once @@ -48,7 +48,7 @@ func (s *Std) Printf(format string, v ...any) { hlog.Verbosef(form const xdgRuntimeDir = "XDG_RUNTIME_DIR" -func (s *Std) Paths() app.Paths { +func (s *Std) Paths() hst.Paths { s.pathsOnce.Do(func() { CopyPaths(s, &s.paths) }) return s.paths } -- cgit v1.3.1