MCPcopy Create free account
hub / github.com/danderson/netboot / debianRecipe

Function debianRecipe

pixiecore/cli/quickcmd.go:34–88  ·  view source on GitHub ↗
(parent *cobra.Command)

Source from the content-addressed store, hash-verified

32}
33
34func debianRecipe(parent *cobra.Command) {
35 versions := []string{
36 "oldstable",
37 "stable",
38 "testing",
39 "unstable",
40
41 "wheezy",
42 "jessie",
43 "stretch",
44 "buster",
45 "sid",
46 }
47
48 debCmd := &cobra.Command{
49 Use: "debian version",
50 Short: "Boot a Debian installer",
51 Long: fmt.Sprintf("Boot a Debian installer for the given version (one of %s)", strings.Join(versions, ",")),
52 Run: func(cmd *cobra.Command, args []string) {
53 if len(args) < 1 {
54 fatalf("you must specify a Debian version")
55 }
56 var version string
57 for _, v := range versions {
58 if args[0] == v {
59 version = v
60 break
61 }
62 }
63 if version == "" {
64 fatalf("Unknown Debian version %q", version)
65 }
66
67 arch, err := cmd.Flags().GetString("arch")
68 if err != nil {
69 fatalf("Error reading flag: %s", err)
70 }
71 mirror, err := cmd.Flags().GetString("mirror")
72 if err != nil {
73 fatalf("Error reading flag: %s", err)
74 }
75
76 kernel := fmt.Sprintf("%s/dists/%s/main/installer-%s/current/images/netboot/debian-installer/%s/linux", mirror, version, arch, arch)
77 initrd := fmt.Sprintf("%s/dists/%s/main/installer-%s/current/images/netboot/debian-installer/%s/initrd.gz", mirror, version, arch, arch)
78
79 fmt.Println(staticFromFlags(cmd, kernel, []string{initrd}, "").Serve())
80 },
81 }
82
83 debCmd.Flags().String("arch", "amd64", "CPU architecture of the Debian installer files")
84 debCmd.Flags().String("mirror", "https://mirrors.kernel.org/debian", "Root of the debian mirror to use")
85 serverConfigFlags(debCmd)
86 staticConfigFlags(debCmd)
87 parent.AddCommand(debCmd)
88}
89
90func ubuntuRecipe(parent *cobra.Command) {
91 versions := []string{

Callers 1

initFunction · 0.85

Calls 6

staticFromFlagsFunction · 0.85
serverConfigFlagsFunction · 0.85
staticConfigFlagsFunction · 0.85
fatalfFunction · 0.70
ServeMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected