Fixup spacing

Tabs, not spaces.
This commit is contained in:
Jeffrey Frey
2022-11-29 14:10:16 -05:00
committed by GitHub
parent 9c3cc59d85
commit e9d7432e79

View File

@@ -596,11 +596,11 @@ func FileGz(
compressor, err := exec.LookPath("pigz")
if err != nil {
wwlog.Verbose("Could not locate PIGZ")
compressor, err := exec.LookPath("gzip")
if err != nil {
wwlog.Verbose("Could not locate GZIP")
return errors.Wrapf(err, "No compressor program for image file: %s", file_gz)
}
compressor, err := exec.LookPath("gzip")
if err != nil {
wwlog.Verbose("Could not locate GZIP")
return errors.Wrapf(err, "No compressor program for image file: %s", file_gz)
}
}
wwlog.Verbose("Using compressor program: %s", compressor)
@@ -612,48 +612,48 @@ func FileGz(
out, err := proc.CombinedOutput()
if len(out) > 0 {
if err != nil && strings.HasSuffix(compressor, "gzip") && strings.Contains(out, "unrecognized option") {
/* Older version of gzip, try it another way: */
wwlog.Verbose("%s does not recognize the --keep flag, trying piped stdout", compressor)
/* Open the output file for writing: */
gzippedFile, err := os.Create(file_gz)
if err != nil {
return errors.Wrapf(err, "Unable to open compressed image file for writing: %s", file_gz)
}
/* We'll execute gzip with output to stdout and attach stdout to the compressed file we just
created:
*/
proc = exec.Command(
compressor,
"--stdout",
file )
proc.Stdout = gzippedFile
gzipStderr, err := proc.StderrPipe()
if err != nil {
return errors.Wrapf(err, "Unable to open stderr pipe for compression program: %s", compressor)
}
/* Execute the command: */
err = proc.Start()
if err != nil {
proc.Wait()
gzippedFile.Close()
os.Remove(file_gz)
err = errors.Wrapf(err, "Unable to successfully execute compression program: %s", compressor)
} else {
err = proc.Wait()
gzippedFile.Close()
if err != nil {
os.Remove(file_gz)
err = errors.Wrapf(err, "Unable to successfully create compressed image file: %s", file_gz)
} else {
wwlog.Verbose("Successfully compressed image file: %s", file_gz)
}
}
out, _ = io.ReadAll(gzipStderr)
}
if err != nil && strings.HasSuffix(compressor, "gzip") && strings.Contains(out, "unrecognized option") {
/* Older version of gzip, try it another way: */
wwlog.Verbose("%s does not recognize the --keep flag, trying piped stdout", compressor)
/* Open the output file for writing: */
gzippedFile, err := os.Create(file_gz)
if err != nil {
return errors.Wrapf(err, "Unable to open compressed image file for writing: %s", file_gz)
}
/* We'll execute gzip with output to stdout and attach stdout to the compressed file we just
created:
*/
proc = exec.Command(
compressor,
"--stdout",
file )
proc.Stdout = gzippedFile
gzipStderr, err := proc.StderrPipe()
if err != nil {
return errors.Wrapf(err, "Unable to open stderr pipe for compression program: %s", compressor)
}
/* Execute the command: */
err = proc.Start()
if err != nil {
proc.Wait()
gzippedFile.Close()
os.Remove(file_gz)
err = errors.Wrapf(err, "Unable to successfully execute compression program: %s", compressor)
} else {
err = proc.Wait()
gzippedFile.Close()
if err != nil {
os.Remove(file_gz)
err = errors.Wrapf(err, "Unable to successfully create compressed image file: %s", file_gz)
} else {
wwlog.Verbose("Successfully compressed image file: %s", file_gz)
}
}
out, _ = io.ReadAll(gzipStderr)
}
wwlog.Debug(string(out))
}