Skip to content

Commit

Permalink
Use yumdownloader
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Jan 9, 2024
1 parent 514f21a commit e2582da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/pkg/rhel.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (pkg *RHELPackage) Download(ctx context.Context, dir string, force bool) (s
return rpmpath, nil
}

err := yumDownload(ctx, pkg.Name, dir)
err := yumDownload(ctx, pkg.Name, pkg.Architecture, dir)
if err != nil {
os.Remove(rpmpath)
return "", fmt.Errorf("rpm download: %s", err)
Expand Down
9 changes: 2 additions & 7 deletions pkg/pkg/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,10 @@ func TarballBTF(ctx context.Context, btf string, out string) error {
// RHEL packages
//

func yumDownload(ctx context.Context, pkg string, destdir string) error {

func yumDownload(ctx context.Context, pkg string, arch string, destdir string) error {
stderr := &bytes.Buffer{}

destDirParam := fmt.Sprintf("--downloaddir=%s", destdir)

binary, args := utils.SudoCMD("yum", "install", "-y", "--downloadonly", destDirParam, pkg)
binary, args := utils.SudoCMD("yumdownloader", "--archlist="+arch, "--destdir="+destdir, pkg)
cmd := exec.CommandContext(ctx, binary, args...)

cmd.Stdout = os.Stdout
cmd.Stderr = stderr

Expand Down

0 comments on commit e2582da

Please sign in to comment.