wit-debian-gui/apt.go

54 lines
1.2 KiB
Go
Raw Normal View History

package main
import (
"go.wit.com/gui"
"go.wit.com/log"
)
func aptGroup(box *gui.Node) {
n := box.NewGroup("apt Resets")
n.NewButton("update apt-file", func() {
// shell.Script("apt -y install apt-file\napt-file update")
// xterm("apt -y install apt-file; apt-file update")
// gui.ErrorWindow("test error window", "this is the error")
err := sudo(func() error {
err := bash("apt install moon-buggy")
return err
})
if err != nil {
log.Warn("Error", "Failed to run:\napt install moon-buggy")
return
}
err = bash("bash -x /tmp/jcarr")
bash("apt -y install apt-file")
bash("apt-file update")
})
n.NewButton("install packages", func() {
aptPackagesWindow()
})
n.NewButton("install base packages", func() {
sudo(func() error {
line := "apt install moon-buggy2"
err := bash(line)
if err != nil {
log.Error(err, "Error", "Failed to run:\n"+line)
return err
}
return nil
})
})
n.NewButton("purge rc-only", func() {
xterm("dpkg -l |grep ^rc | awk '{print $2}' |xargs apt remove --purge -y")
})
n.NewButton("install defaults", func() {
xterm("./resources/bin/setup-packages-default")
})
n.NewButton("install kvm", func() {
xterm("./resources/bin/setup-packages-kvm")
})
}