Skip to content

Commit

Permalink
u-root: default to building with gobusybox if GO111MODULE!="off"
Browse files Browse the repository at this point in the history
The build process now defaults to the new gobusybox UNLESS
GO111MODULE is set to off.

Signed-off-by: Ronald G. Minnich <[email protected]>
  • Loading branch information
rminnich committed Dec 8, 2021
1 parent ebce0b0 commit f0724a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions u-root.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func init() {
tags = flag.String("tags", "", "Comma separated list of build tags")

// Flags for the gobusybox, which we hope to move to, since it works with modules.
usegobusybox = flag.Bool("gobusybox", false, "Use the new gobusybox package to build u-root")
usegobusybox = flag.Bool("gobusybox", os.Getenv("GO111MODULE") != "off", "Use the new gobusybox package to build u-root")
genDir = flag.String("gen-dir", "", "Directory to generate source in")

}
Expand Down Expand Up @@ -169,12 +169,15 @@ func gobusyboxMain() error {
if tmpDir == "" {
tdir, err := ioutil.TempDir("", "bb-")
if err != nil {
log.Fatalf("Could not create busybox source directory: %v", err)
return fmt.Errorf("Could not create busybox source directory: %v", err)
}
tmpDir = tdir
remove = true
}

if len(flag.Args()) == 0 {
return fmt.Errorf("commands must be provided, as a path or glob, e.g., u-root cmds/core/* cmds/exp/rush")
}
opts := &gbb.Opts{
Env: env,
GenSrcDir: tmpDir,
Expand Down

0 comments on commit f0724a5

Please sign in to comment.