mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-10-03 15:29:44 +00:00
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>
29 lines
752 B
Go
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
|
|
}
|