From e0e2f40e84a5a63a2ea220a0974ac56e6a52c48a Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 26 Dec 2024 13:21:49 +0900 Subject: cmd/fpkg: app bundle helper This helper program creates fortify configuration for running an application bundle. The activate action wraps a home-manager activation package and ensures each generation gets activated once. Signed-off-by: Ophestra --- cmd/fpkg/main.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 cmd/fpkg/main.go (limited to 'cmd/fpkg/main.go') diff --git a/cmd/fpkg/main.go b/cmd/fpkg/main.go new file mode 100644 index 00000000..f348cb5e --- /dev/null +++ b/cmd/fpkg/main.go @@ -0,0 +1,48 @@ +package main + +import ( + "flag" + "os" + + "git.gensokyo.uk/security/fortify/internal/fmsg" +) + +const shell = "/run/current-system/sw/bin/bash" + +func init() { + if err := os.Setenv("SHELL", shell); err != nil { + fmsg.Fatalf("cannot set $SHELL: %v", err) + } +} + +var ( + flagVerbose bool +) + +func init() { + flag.BoolVar(&flagVerbose, "v", false, "Verbose output") +} + +func main() { + fmsg.SetPrefix("fpkg") + + flag.Parse() + fmsg.SetVerbose(flagVerbose) + + args := flag.Args() + if len(args) < 1 { + fmsg.Fatal("invalid argument") + } + + switch args[0] { + case "install": + actionInstall(args[1:]) + case "start": + actionStart(args[1:]) + + default: + fmsg.Fatal("invalid argument") + } + + fmsg.Exit(0) +} -- cgit v1.3.1