Skip to content

Commit

Permalink
changed os-files implementation to use the existing CopyFiles function
Browse files Browse the repository at this point in the history
  • Loading branch information
jdob committed Jun 12, 2024
1 parent fb40e6a commit e1062e7
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions pkg/combustion/osfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package combustion
import (
_ "embed"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"

"github.com/suse-edge/edge-image-builder/pkg/fileio"
Expand Down Expand Up @@ -73,23 +71,13 @@ func copyOSFiles(ctx *image.Context) error {
}
}()

cmd := generateOSFilesCopyCommand(srcDirectory, destDirectory, logFile)
if err := cmd.Run(); err != nil {
if err := fileio.CopyFiles(srcDirectory, destDirectory, "", true); err != nil {
return fmt.Errorf("running copy os-files command: %w", err)
}

return nil
}

func generateOSFilesCopyCommand(srcDirectory string, destDirectory string, output io.Writer) *exec.Cmd {
cmd := exec.Command("cp", "-R", srcDirectory, destDirectory)

cmd.Stdout = output
cmd.Stderr = output

return cmd
}

func writeOSFilesScript(ctx *image.Context) error {
osFilesScriptFilename := filepath.Join(ctx.CombustionDir, osFilesScriptName)

Expand Down

0 comments on commit e1062e7

Please sign in to comment.