forked from u-root/u-root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (31 loc) · 739 Bytes
/
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
// Copyright 2018 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 is the busybox main.go template.
package main
import (
"log"
"os"
"path/filepath"
"github.com/u-root/u-root/pkg/bb/bbmain"
"github.com/u-root/u-root/pkg/uroot/util"
)
func run() {
name := filepath.Base(os.Args[0])
if err := bbmain.Run(name); err != nil {
log.Fatalf("%s: %v", name, err)
}
}
func main() {
os.Args[0] = util.ResolveUntilLastSymlink(os.Args[0])
run()
}
func init() {
m := func() {
// Use argv[1] as the name.
os.Args = os.Args[1:]
run()
}
bbmain.Register("bb", bbmain.Noop, m)
bbmain.RegisterDefault(bbmain.Noop, m)
}