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

Function archRecipe

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

Source from the content-addressed store, hash-verified

312}
313
314func archRecipe(parent *cobra.Command) {
315 archCmd := &cobra.Command{
316 Use: "arch [version]",
317 Short: "Boot Arch Linux live image",
318 Long: `Boot Arch Linux live image for the given version
319version defaults to latest, can also be a YYYY.MM.DD iso release version`,
320 Run: func(cmd *cobra.Command, args []string) {
321 version := "latest"
322 if len(args) >= 1 {
323 version = args[0]
324 }
325
326 arch := "x86_64"
327 mirror, err := cmd.Flags().GetString("mirror")
328 if err != nil {
329 fatalf("Error reading flag: %s", err)
330 }
331
332 httpSrv := fmt.Sprintf("%s/iso/%s", mirror, version)
333 kernel := fmt.Sprintf("%s/arch/boot/%s/vmlinuz-linux", httpSrv, arch)
334 initrd := fmt.Sprintf("%s/arch/boot/%s/initramfs-linux.img", httpSrv, arch)
335 cmdline := fmt.Sprintf("archisobasedir=arch archiso_http_srv=%s/ ip=dhcp cms_verify=y net.ifnames=0", httpSrv)
336
337 fmt.Println(staticFromFlags(cmd, kernel, []string{initrd}, cmdline).Serve())
338 },
339 }
340 archCmd.Flags().String("mirror", "https://mirrors.kernel.org/archlinux", "Root of the archlinux mirror to use")
341 serverConfigFlags(archCmd)
342 staticConfigFlags(archCmd)
343 parent.AddCommand(archCmd)
344}
345
346func init() {
347 rootCmd.AddCommand(quickCmd)

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