fortify/cmd/fpkg/main.go
Ophestra e0e2f40e84
All checks were successful
Tests / Go tests (push) Successful in 43s
Nix / NixOS tests (push) Successful in 4m25s
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 <cat@gensokyo.uk>
2024-12-26 13:21:49 +09:00

49 lines
683 B
Go

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)
}