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>
This commit is contained in:
48
cmd/fpkg/main.go
Normal file
48
cmd/fpkg/main.go
Normal file
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user