Add Arch Linux into quick boot options

This commit is contained in:
afg 2018-08-28 18:17:47 +08:00 committed by Dave Anderson
parent c08175e180
commit 603e85bc4c

View File

@ -299,6 +299,38 @@ func netbootRecipe(parent *cobra.Command) {
parent.AddCommand(netbootCmd)
}
func archRecipe(parent *cobra.Command) {
archCmd := &cobra.Command{
Use: "arch [version]",
Short: "Boot Arch Linux live image",
Long: `Boot Arch Linux live image for the given version
version defaults to latest, can also be a YYYY.MM.DD iso release version`,
Run: func(cmd *cobra.Command, args []string) {
version := "latest"
if len(args) >= 1 {
version = args[0]
}
arch := "x86_64"
mirror, err := cmd.Flags().GetString("mirror")
if err != nil {
fatalf("Error reading flag: %s", err)
}
httpSrv := fmt.Sprintf("%s/iso/%s", mirror, version)
kernel := fmt.Sprintf("%s/arch/boot/%s/vmlinuz", httpSrv, arch)
initrd := fmt.Sprintf("%s/arch/boot/%s/archiso.img", httpSrv, arch)
cmdline := fmt.Sprintf("archisobasedir=arch archiso_http_srv=%s/ ip=dhcp verify=y net.ifnames=0", httpSrv)
fmt.Println(staticFromFlags(cmd, kernel, []string{initrd}, cmdline).Serve())
},
}
archCmd.Flags().String("mirror", "https://mirrors.kernel.org/archlinux", "Root of the archlinux mirror to use")
serverConfigFlags(archCmd)
staticConfigFlags(archCmd)
parent.AddCommand(archCmd)
}
func init() {
rootCmd.AddCommand(quickCmd)
debianRecipe(quickCmd)
@ -307,6 +339,7 @@ func init() {
centosRecipe(quickCmd)
netbootRecipe(quickCmd)
coreosRecipe(quickCmd)
archRecipe(quickCmd)
// TODO: some kind of caching support where quick OSes get
// downloaded locally, so you don't have to fetch from a remote