Files
mixer-tools/swupd/fullchroot.go
T
Matthew Johnson 8bdab29f8d Do not init image directories from manifest creation
This step was completely unnecessary and created empty chroot
directories in the image dir. This was a product of a too-direct port of
the old swupd-server for this specific part of the rewrite. It probably
wasn't even needed in the old swupd-server.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-03-22 17:07:28 -07:00

29 lines
752 B
Go

package swupd
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
func syncToFull(version uint32, bundle string, imageBase string) error {
fullPath := filepath.Join(imageBase, fmt.Sprint(version), "full")
// MkdirAll returns nil when the path exists, so we continue to do the
// full chroot creation over the existing one
if err := os.MkdirAll(fullPath, 0777); err != nil {
return err
}
// append trailing slash to get contents only
bundlePath := filepath.Join(imageBase, fmt.Sprint(version), bundle) + "/"
if _, err := os.Stat(bundlePath); err == nil {
cmd := exec.Command("rsync", "-aAX", "--ignore-existing", bundlePath, fullPath)
if err := cmd.Run(); err != nil {
return fmt.Errorf("rsync error: %v", err)
}
}
return nil
}