diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-04-12 13:56:41 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-04-12 13:56:41 +0900 |
| commit | 6309469e933a31a300fbf16d8e77f48dcee402d3 (patch) | |
| tree | 8f8a72ee02b3ca15b104a6e55c9379e20f8d7e8a /main.go | |
| parent | 0d7c1a9a4356614f035225aeb24e66421879a99b (diff) | |
app/instance: wrap internal implementation
This reduces the scope of the fst package, which was growing questionably large.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -19,7 +19,8 @@ import ( "git.gensokyo.uk/security/fortify/dbus" "git.gensokyo.uk/security/fortify/fst" "git.gensokyo.uk/security/fortify/internal" - "git.gensokyo.uk/security/fortify/internal/app/setuid" + "git.gensokyo.uk/security/fortify/internal/app" + "git.gensokyo.uk/security/fortify/internal/app/instance" "git.gensokyo.uk/security/fortify/internal/fmsg" "git.gensokyo.uk/security/fortify/internal/state" "git.gensokyo.uk/security/fortify/internal/sys" @@ -73,7 +74,7 @@ func buildCommand(out io.Writer) command.Command { Flag(&flagVerbose, "v", command.BoolFlag(false), "Print debug messages to the console"). Flag(&flagJSON, "json", command.BoolFlag(false), "Serialise output as JSON when applicable") - c.Command("shim", command.UsageInternal, func([]string) error { setuid.ShimMain(); return errSuccess }) + c.Command("shim", command.UsageInternal, func([]string) error { instance.ShimMain(); return errSuccess }) c.Command("app", "Launch app defined by the specified config file", func(args []string) error { if len(args) < 1 { @@ -239,11 +240,11 @@ func buildCommand(out io.Writer) command.Command { case 1: // instance name := args[0] - config, instance := tryShort(name) + config, entry := tryShort(name) if config == nil { config = tryPath(name) } - printShowInstance(os.Stdout, time.Now().UTC(), instance, config, showFlagShort, flagJSON) + printShowInstance(os.Stdout, time.Now().UTC(), entry, config, showFlagShort, flagJSON) default: log.Fatal("show requires 1 argument") @@ -284,14 +285,14 @@ func runApp(config *fst.Config) { ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer stop() // unreachable - a := setuid.MustNew(ctx, std) + a := instance.MustNew(instance.ISetuid, ctx, std) - rs := new(fst.RunState) + rs := new(app.RunState) if sa, err := a.Seal(config); err != nil { fmsg.PrintBaseError(err, "cannot seal app:") internal.Exit(1) } else { - internal.Exit(setuid.PrintRunStateErr(rs, sa.Run(rs))) + internal.Exit(instance.PrintRunStateErr(instance.ISetuid, rs, sa.Run(rs))) } *(*int)(nil) = 0 // not reached |
