|
2 | 2 | // Use of this source code is governed by a BSD-style |
3 | 3 | // license that can be found in the LICENSE file. |
4 | 4 |
|
5 | | -// +build go1.11 |
6 | | - |
7 | 5 | package main |
8 | 6 |
|
9 | 7 | //include a loading bar |
@@ -205,24 +203,14 @@ func goBuildStatic() error { |
205 | 203 | return nil |
206 | 204 | } |
207 | 205 |
|
| 206 | +// A new change: we no longer need to add u-root to this partition, |
| 207 | +// as we build it all for the "static" case. |
208 | 208 | func goBuildDynamic() error { |
209 | | - args := []string{"-o", filepath.Join(workingDir, initramfs)} |
210 | | - for _, v := range []string{"usr", "lib", "tcz", "etc", "upspin", ".ssh"} { |
211 | | - if _, err := os.Stat(v); err != nil { |
212 | | - continue |
213 | | - } |
214 | | - args = append(args, "-files", filepath.Join(workingDir, v)+":"+v) |
215 | | - } |
| 209 | + args := []string{"-o", filepath.Join(workingDir, initramfs), "-nocmd", "-files", "rootfs:", "-files", "/usr/bin/bash", "-base", "/dev/null"} |
216 | 210 | log.Print("WARNING: skipping pkg/sos/html; fix me") |
217 | 211 | if false { |
218 | 212 | args = append(args, "-files", "pkg/sos/html:etc/sos/html") |
219 | 213 | } |
220 | | - args = append(args, dynamicCmdList...) |
221 | | - n, err := filepath.Glob("../u-root/cmds/*/*") |
222 | | - if err != nil { |
223 | | - return fmt.Errorf("../u-root/cmds/*/*: %v", err) |
224 | | - } |
225 | | - args = append(args, n...) |
226 | 214 | log.Printf("Run u-root with args %v", args) |
227 | 215 | cmd := exec.Command("u-root", args...) |
228 | 216 | cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr |
@@ -346,14 +334,21 @@ func installUrootGpt() error { |
346 | 334 | func vbutilIt() error { |
347 | 335 | // Try to read a GPT header from our output file. If we can, add a root_guid |
348 | 336 | // to config.txt, otherwise, don't bother. |
349 | | - args := []string{"gpt", *dev} |
350 | | - msg, err := exec.Command("sudo", args...).Output() |
351 | | - if err != nil { |
352 | | - log.Printf("gpt %v failed (warning only): %v", args, err) |
353 | | - } |
| 337 | + var pt = &gpt.PartitionTable{} |
354 | 338 | var pg gpt.GUID |
355 | | - if err == nil { |
356 | | - var pt = &gpt.PartitionTable{} |
| 339 | + if *dev == "/dev/null" { |
| 340 | + log.Printf("Skipping the gpt step, since *dev is /dev/null") |
| 341 | + } else { |
| 342 | + gptcmd, err := exec.LookPath("gpt") |
| 343 | + if err != nil { |
| 344 | + return fmt.Errorf("Can not find a GPT command: %v", err) |
| 345 | + } |
| 346 | + args := []string{gptcmd, *dev} |
| 347 | + msg, err := exec.Command("sudo", args...).Output() |
| 348 | + if err != nil { |
| 349 | + return fmt.Errorf("gpt %v failed: %v", args, err) |
| 350 | + } |
| 351 | + |
357 | 352 | if err := json.NewDecoder(bytes.NewBuffer(msg)).Decode(&pt); err != nil { |
358 | 353 | log.Printf("Reading in GPT JSON, warning only: %v", err) |
359 | 354 | } else if pt.Primary == nil || pt.MasterBootRecord == nil { |
|
0 commit comments