When available, use "pigz" to speedup compression.

This commit is contained in:
Yong Qin
2021-04-24 21:00:22 -07:00
parent dc3a60cce7
commit 2e1017ca63
3 changed files with 18 additions and 1 deletions

View File

@@ -42,6 +42,12 @@ func Build(name string, buildForce bool) error {
wwlog.Printf(wwlog.DEBUG, "Building VNFS image: '%s' -> '%s'\n", rootfsPath, imagePath)
cmd := fmt.Sprintf("cd %s; find . | cpio --quiet -o -H newc | gzip -c > \"%s\"", rootfsPath, imagePath)
// use pigz if available
err = exec.Command("/bin/sh", "-c", "command -v pigz").Run()
if err == nil {
cmd = fmt.Sprintf("cd %s; find . | cpio --quiet -o -H newc | pigz -c > \"%s\"", rootfsPath, imagePath)
}
wwlog.Printf(wwlog.DEBUG, "RUNNING: %s\n", cmd)
err = exec.Command("/bin/sh", "-c", cmd).Run()
if err != nil {
return errors.New("Failed building VNFS")