Local VM image building
This commit is contained in:
parent
583f443e7e
commit
e7605dc289
13 changed files with 359 additions and 239 deletions
30
cmd/build.go
Normal file
30
cmd/build.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var buildCmd = &cobra.Command{
|
||||
Use: "build",
|
||||
Short: "Build (set up) a VM image for local use. This needs to be run after the initial installation.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
store := createStore()
|
||||
|
||||
err := store.BuildVMImageWithInterruptHandler(vmDebugFlag, buildOverwriteFlag)
|
||||
if err != nil {
|
||||
slog.Error("Failed to build VM image", "error", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
slog.Info("VM image built successfully", "path", store.GetVMImagePath())
|
||||
},
|
||||
}
|
||||
|
||||
var buildOverwriteFlag bool
|
||||
|
||||
func init() {
|
||||
buildCmd.Flags().BoolVar(&buildOverwriteFlag, "overwrite", false, "Specifies whether the VM image should be overwritten with the build.")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue