mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
cmd: Restructure iPXE script code for packet backend
Break it into multiple instructions. The single line was super hard to parse. Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
bbf8741002
commit
934d818bf1
@ -88,13 +88,24 @@ func runPacket(args []string) {
|
||||
name := getStringValue(packetNameVar, *nameFlag, prefix)
|
||||
osType := "custom_ipxe"
|
||||
billing := "hourly"
|
||||
|
||||
// Build the iPXE script
|
||||
// TODO(rn): Extract the kernel commandline from the file generated by moby build
|
||||
userData := fmt.Sprintf("#!ipxe\n\ndhcp\nset base-url %s\nset kernel-params ip=dhcp nomodeset ro serial console=ttyS1,115200\nkernel ${base-url}/%s-kernel ${kernel-params}\ninitrd ${base-url}/%s-initrd.img\nboot", url, name, name)
|
||||
userData := "#!ipxe\n\n"
|
||||
userData += "dhcp\n"
|
||||
userData += fmt.Sprintf("set base-url %s\n", url)
|
||||
userData += "set kernel-params ip=dhcp nomodeset ro serial console=ttyS1,115200\n"
|
||||
userData += fmt.Sprintf("kernel ${base-url}/%s-kernel ${kernel-params}\n", name)
|
||||
userData += fmt.Sprintf("initrd ${base-url}/%s-initrd.img\n", name)
|
||||
userData += "boot"
|
||||
log.Debugf("Using userData of:\n%s\n", userData)
|
||||
|
||||
// Make sure the URL works
|
||||
initrdURL := fmt.Sprintf("%s/%s-initrd.img", url, name)
|
||||
kernelURL := fmt.Sprintf("%s/%s-kernel", url, name)
|
||||
validateHTTPURL(kernelURL)
|
||||
validateHTTPURL(initrdURL)
|
||||
|
||||
client := packngo.NewClient("", apiKey, nil)
|
||||
tags := []string{}
|
||||
req := packngo.DeviceCreateRequest{
|
||||
|
Loading…
Reference in New Issue
Block a user