Skip to content

Set env to non-interactive #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apt.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,29 @@ func Upgrade(packs ...*Package) (output []byte, err error) {
args = append(args, pack.Name)
}
cmd := exec.Command("apt-get", args...)
cmd.Env = append(cmd.Env,
"DEBIAN_FRONTEND=noninteractive",
)

return cmd.CombinedOutput()
}

// UpgradeAll upgrade all upgradable packages
func UpgradeAll() (output []byte, err error) {
cmd := exec.Command("apt-get", "upgrade", "-y")
cmd.Env = append(cmd.Env,
"DEBIAN_FRONTEND=noninteractive",
)

return cmd.CombinedOutput()
}

// DistUpgrade upgrades all upgradable packages, it may remove older versions to install newer ones.
func DistUpgrade() (output []byte, err error) {
cmd := exec.Command("apt-get", "dist-upgrade", "-y")
cmd.Env = append(cmd.Env,
"DEBIAN_FRONTEND=noninteractive",
)
return cmd.CombinedOutput()
}

Expand All @@ -171,5 +182,9 @@ func Install(packs ...*Package) (output []byte, err error) {
args = append(args, pack.Name)
}
cmd := exec.Command("apt-get", args...)
cmd.Env = append(cmd.Env,
"DEBIAN_FRONTEND=noninteractive",
)

return cmd.CombinedOutput()
}