From 33a4ab11c226c736c0d8b2644fbbe27a5ca045e9 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 16 Feb 2025 16:28:46 +0900 Subject: internal: move shim and init into app This structure makes more sense, as both processes are part of an app's lifecycle. Signed-off-by: Ophestra --- internal/app/init/early.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 internal/app/init/early.go (limited to 'internal/app/init/early.go') diff --git a/internal/app/init/early.go b/internal/app/init/early.go new file mode 100644 index 00000000..cc1c2f7e --- /dev/null +++ b/internal/app/init/early.go @@ -0,0 +1,18 @@ +package init0 + +import ( + "os" + "path" + + "git.gensokyo.uk/security/fortify/internal/fmsg" +) + +// used by the parent process + +// TryArgv0 calls [Main] if argv0 indicates the process is started from a file named "init". +func TryArgv0() { + if len(os.Args) > 0 && path.Base(os.Args[0]) == "init" { + Main() + fmsg.Exit(0) + } +} -- cgit v1.3.1