Ophestra
e0e2f40e84
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>
49 lines
683 B
Go
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)
|
|
}
|