Skip to content

Commit

Permalink
add yes flag for apt-get
Browse files Browse the repository at this point in the history
  • Loading branch information
mycrEEpy committed Oct 25, 2024
1 parent adaf117 commit 7bcba6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions internal/manager/apt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (m *Apt) InstallPackages(ctx context.Context, verbose bool) error {
for _, pkg := range m.Packages {
fmt.Printf("Installing %s with apt...\n", pkg)

err := runCommand(ctx, []string{"apt-get", "install", pkg}, m.Sudo, verbose)
err := runCommand(ctx, []string{"apt-get", "--yes", "install", pkg}, m.Sudo, verbose)
if err != nil {
return fmt.Errorf("failed to install %s: %w", pkg, err)
}
Expand All @@ -30,10 +30,10 @@ func (m *Apt) UpdatePackages(ctx context.Context, verbose bool) error {

fmt.Println("Updating packages with apt...")

err := runCommand(ctx, []string{"apt-get", "update"}, m.Sudo, verbose)
err := runCommand(ctx, []string{"apt-get", "--yes", "update"}, m.Sudo, verbose)
if err != nil {
return err
}

return runCommand(ctx, append([]string{"apt-get", "upgrade"}, m.Packages...), m.Sudo, verbose)
return runCommand(ctx, append([]string{"apt-get", "--yes", "upgrade"}, m.Packages...), m.Sudo, verbose)
}
4 changes: 2 additions & 2 deletions internal/manager/dnf.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (m *Dnf) InstallPackages(ctx context.Context, verbose bool) error {
for _, pkg := range m.Packages {
fmt.Printf("Installing %s with dnf...\n", pkg)

err := runCommand(ctx, []string{"dnf", "install", "--yes", pkg}, m.Sudo, verbose)
err := runCommand(ctx, []string{"dnf", "--yes", "install", pkg}, m.Sudo, verbose)
if err != nil {
return fmt.Errorf("failed to install %s: %w", pkg, err)
}
Expand All @@ -30,5 +30,5 @@ func (m *Dnf) UpdatePackages(ctx context.Context, verbose bool) error {

fmt.Println("Updating packages with dnf...")

return runCommand(ctx, append([]string{"dnf", "upgrade", "--yes"}, m.Packages...), m.Sudo, verbose)
return runCommand(ctx, append([]string{"dnf", "--yes", "upgrade"}, m.Packages...), m.Sudo, verbose)
}

0 comments on commit 7bcba6e

Please sign in to comment.