2
0
mirror of https://github.com/linka-cloud/d2vm.git synced 2025-06-27 23:52:27 +00:00

add "append-to-cmdline" option

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2022-08-07 18:24:02 +02:00
parent 92cd70430b
commit 0c24236da9
4 changed files with 28 additions and 23 deletions

View File

@ -47,14 +47,14 @@ var (
return err
}
exec.SetDebug(debug)
logrus.Infof("building docker image from %s", file)
if file == "" {
file = filepath.Join(args[0], "Dockerfile")
}
logrus.Infof("building docker image from %s", file)
if err := docker.Build(cmd.Context(), tag, file, args[0], buildArgs...); err != nil {
return err
}
return d2vm.Convert(cmd.Context(), tag, size, password, output)
return d2vm.Convert(cmd.Context(), tag, size, password, output, cmdLineExtra)
},
}
)
@ -70,4 +70,5 @@ func init() {
buildCmd.Flags().StringVarP(&size, "size", "s", "10G", "The output image size")
buildCmd.Flags().BoolVarP(&debug, "debug", "d", false, "Enable Debug output")
buildCmd.Flags().BoolVar(&force, "force", false, "Override output image")
buildCmd.Flags().StringVar(&cmdLineExtra, "append-to-cmdline", "", "Extra kernel cmdline arguments to append to the generated one")
}

View File

@ -30,7 +30,8 @@ import (
)
var (
pull = false
pull = false
cmdLineExtra = ""
convertCmd = &cobra.Command{
Use: "convert [docker image]",
@ -78,7 +79,7 @@ var (
return err
}
}
return d2vm.Convert(cmd.Context(), img, size, password, output)
return d2vm.Convert(cmd.Context(), img, size, password, output, cmdLineExtra)
},
}
)
@ -98,5 +99,6 @@ func init() {
convertCmd.Flags().StringVarP(&size, "size", "s", "10G", "The output image size")
convertCmd.Flags().BoolVarP(&debug, "debug", "d", false, "Enable Debug output")
convertCmd.Flags().BoolVarP(&force, "force", "f", false, "Override output qcow2 image")
convertCmd.Flags().StringVar(&cmdLineExtra, "append-to-cmdline", "", "Extra kernel cmdline arguments to append to the generated one")
rootCmd.AddCommand(convertCmd)
}