(parent *cobra.Command)
| 312 | } |
| 313 | |
| 314 | func 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 |
| 319 | version 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 | |
| 346 | func init() { |
| 347 | rootCmd.AddCommand(quickCmd) |
no test coverage detected