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