github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/tools/vpdbootmanager/main.go (about) 1 // Copyright 2017-2019 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 "os" 10 ) 11 12 const usage = `Usage: 13 %s add [netboot [dhcpv6|dhcpv4] [MAC] | localboot [grub|path [Device GUID] [Kernel Path]]] 14 15 Ex. 16 add localboot grub 17 add netboot dhcpv6 AA:BB:CC:DD:EE:FF 18 19 Flags for netboot: 20 21 -override-url - an optional URL used to override the boot file URL used 22 -retries - the number of times a DHCP request should be retried if failed 23 24 Flags for localboot: 25 26 -kernel-args - additional kernel args 27 -ramfs - path of ramfs to be used for kexec'ing into the target kernel 28 29 Global flags: 30 31 -vpd-dir - VPD dir to use 32 33 ` 34 35 func main() { 36 if err := cli(os.Args[1:]); err != nil { 37 fmt.Printf(usage, os.Args[0]) 38 fmt.Printf("Error: %s\n\n", err) 39 os.Exit(1) 40 } 41 } 42 43 func cli(args []string) error { 44 if len(args) < 1 { 45 return fmt.Errorf("You need to provide action") 46 } 47 switch args[0] { 48 case "add": 49 return add(args[1], args[2:]) 50 } 51 return fmt.Errorf("Unrecognized action") 52 }