mirror of
https://github.com/danderson/netboot.git
synced 2025-10-15 17:41:38 +02:00
pixiecore/cli: pass Ipxe firmwares as a package global.
The cli package is meant for single-shot execution anyway, so instead of plumbing everything through reentrantly, let's just have a global you can seed before calling CLI().
This commit is contained in:
parent
b43c25904b
commit
62e2f4bee3
@ -17,5 +17,5 @@ package main
|
||||
import "go.universe.tf/netboot/pixiecore/cli"
|
||||
|
||||
func main() {
|
||||
cli.CLI(nil)
|
||||
cli.CLI()
|
||||
}
|
||||
|
@ -21,13 +21,8 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
pxe := ipxe.MustAsset("undionly.kpxe")
|
||||
efi32 := ipxe.MustAsset("ipxe-i386.efi")
|
||||
efi64 := ipxe.MustAsset("ipxe-x86_64.efi")
|
||||
|
||||
cli.CLI(map[pixiecore.Firmware][]byte{
|
||||
pixiecore.FirmwareX86PC: pxe,
|
||||
pixiecore.FirmwareEFI32: efi32,
|
||||
pixiecore.FirmwareEFI64: efi64,
|
||||
})
|
||||
cli.Ipxe[pixiecore.FirmwareX86PC] = ipxe.MustAsset("undionly.kpxe")
|
||||
cli.Ipxe[pixiecore.FirmwareEFI32] = ipxe.MustAsset("ipxe-i386.efi")
|
||||
cli.Ipxe[pixiecore.FirmwareEFI64] = ipxe.MustAsset("ipxe-x86_64.efi")
|
||||
cli.CLI()
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ var bootCmd = &cobra.Command{
|
||||
|
||||
s := &pixiecore.Server{
|
||||
Booter: pixiecore.StaticBooter(spec),
|
||||
Ipxe: nil, // TODO
|
||||
Ipxe: Ipxe,
|
||||
Log: func(msg string) { fmt.Println(msg) },
|
||||
}
|
||||
fmt.Println(s.Serve())
|
||||
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package cli implements the commandline interface for Pixiecore.
|
||||
package cli
|
||||
|
||||
import (
|
||||
@ -23,10 +24,16 @@ import (
|
||||
"go.universe.tf/netboot/pixiecore"
|
||||
)
|
||||
|
||||
// Ipxe is the set of ipxe binaries for supported firmwares.
|
||||
//
|
||||
// Can be set externally before calling CLI(), and set/extended by
|
||||
// commandline processing in CLI().
|
||||
var Ipxe = map[pixiecore.Firmware][]byte{}
|
||||
|
||||
// CLI runs the Pixiecore commandline.
|
||||
//
|
||||
// Takes a map of ipxe bootloader binaries for various architectures.
|
||||
func CLI(ipxe map[pixiecore.Firmware][]byte) {
|
||||
func CLI() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(-1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user