Skip to content

Commit

Permalink
fix docker sha256 copying
Browse files Browse the repository at this point in the history
  • Loading branch information
kminehart committed Sep 13, 2023
1 parent 8918ee8 commit 5203571
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/move_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,13 @@ func main() {
// tar.gz extensions can also have docker.tar.gz so we need to make sure we don't skip that
if ext == ".gz" {
ext = ".tar.gz"
if filepath.Ext(strings.ReplaceAll(name, ext, "")) == ".docker" {
if filepath.Ext(strings.ReplaceAll(name, ".tar.gz", "")) == ".docker" ||
filepath.Ext(strings.ReplaceAll(name, ".tar.gz.sha256", "")) == ".docker" {
ext = ".docker.tar.gz"
}
}
log.Printf("[%s] Using handler for %s", name, ext)

handler := Handlers[ext]
if ext == "" {
destinations := make([]string, 0)
Expand Down Expand Up @@ -433,14 +436,17 @@ func main() {
}

destinations := handler(name)
log.Println("File:", name, "to be copied as", destinations)
for _, v := range destinations {
dir := filepath.Join(prefix, filepath.Dir(v))
v := filepath.Join(prefix, v)
log.Println("Creating directory", dir)
if err := os.MkdirAll(dir, 0700); err != nil {
panic(err)
}
log.Println("Copying", name, "to", dir)

log.Println("Copying", name, "to", dir, "as", v)

//nolint:gosec
cmd := exec.Command("cp", strings.TrimPrefix(name, "file://"), v)
cmd.Stdout = os.Stdout
Expand Down

0 comments on commit 5203571

Please sign in to comment.