Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-23 14:41:23 -05:00
parent 0405ab64a4
commit 43c4f11352
2 changed files with 47 additions and 30 deletions

44
apt.go Normal file
View File

@ -0,0 +1,44 @@
package main
import (
"log"
"os"
// "git.wit.org/wit/gui"
)
func aptTab() {
aptTab := mainWindow.NewTab("apt")
box := aptTab.NewBox("aptBox", false)
box.NewButton("apt sources", func () {
if _, err := os.Stat("/etc/apt/sources.list.d/wit.list"); err == nil {
log.Println("apt sources are already configured")
} else {
myGui.CloseToolkit("gocui")
writeRes("resources/", "/etc/", "apt/sources.list")
writeRes("resources/", "/etc/", "apt/sources.list.d/wit.list")
writeRes("resources/", "/etc/", "apt/sources.list.d/debian.list")
writeRes("resources/apt/", "/etc/wit/", "wit.gpg")
doCmd("apt update")
doCmd("apt dist-upgrade")
log.Println("\nYou should reboot now\n")
os.Exit(0)
}
})
box.NewButton("apt-file", func () {
myGui.CloseToolkit("gocui")
doCmd("apt install apt-file")
doCmd("apt-file update")
doCmd("apt-file -x search '/libOpenCL.so.1'")
os.Exit(0)
})
box.NewButton("install defaults", func () {
myGui.CloseToolkit("gocui")
doCmd("apt install lsof bash-completion libpam-systemd dbus rbd-nbd golang-go git screen vim " +
"ethstatus iftop ethtool sysstat traceroute whois devscripts automake libtool devscripts " +
"nmap clang rsync bind9utils dnsutils net-tools tcpdump wget curl iputils-ping pciutils " +
"iptables sysbench man usbutils ssh neofetch bc lshw telnet hdparm vrms")
os.Exit(0)
})
}

33
gui.go
View File

@ -42,6 +42,7 @@ func drawWindow() {
//////////////////// General GUI debugging /////////////////////////
g = newTab.NewGroup("Debug")
// g = mainWindow.NewGroup("Debug")
padding = g.NewCheckbox("padding")
xtermHold = g.NewCheckbox("xterm -hold")
@ -55,36 +56,6 @@ func drawWindow() {
/////////////////////////////////////////////////////////////////////////////
rn := newTab.NewGroup("Local Linux Settings")
rn.NewButton("apt sources", func () {
if _, err := os.Stat("/etc/apt/sources.list.d/wit.list"); err == nil {
log.Println("apt sources are already configured")
} else {
myGui.CloseToolkit("gocui")
writeRes("resources/", "/etc/", "apt/sources.list")
writeRes("resources/", "/etc/", "apt/sources.list.d/wit.list")
writeRes("resources/", "/etc/", "apt/sources.list.d/debian.list")
writeRes("resources/apt/", "/etc/wit/", "wit.gpg")
doCmd("apt update")
doCmd("apt dist-upgrade")
log.Println("\nYou should reboot now\n")
os.Exit(0)
}
})
rn.NewButton("apt-file", func () {
myGui.CloseToolkit("gocui")
doCmd("apt install apt-file")
doCmd("apt-file update")
doCmd("apt-file -x search '/libOpenCL.so.1'")
os.Exit(0)
})
rn.NewButton("install defaults", func () {
myGui.CloseToolkit("gocui")
doCmd("apt install lsof bash-completion libpam-systemd dbus rbd-nbd golang-go git screen vim " +
"ethstatus iftop ethtool sysstat traceroute whois devscripts automake libtool devscripts " +
"nmap clang rsync bind9utils dnsutils net-tools tcpdump wget curl iputils-ping pciutils " +
"iptables sysbench man usbutils ssh neofetch bc lshw telnet hdparm vrms")
os.Exit(0)
})
rn.NewButton("purge rc-only", func () {
xterm("cd ~/jcarr/setup; make reset-purge-rc-only-packages")
})
@ -129,4 +100,6 @@ func drawWindow() {
s := resolv.GetText()
log.Println("supposed to make the resolv.conf window\n\n", s)
})
aptTab()
}