wit-new-machine/setup.go

60 lines
1.7 KiB
Go
Raw Normal View History

2023-04-12 12:21:23 -05:00
package main
import (
"go.wit.com/gui"
2023-04-12 12:21:23 -05:00
)
// setup a new machine
var command string
var commandEntry *gui.Node
func setupNewMachine(cur *gui.Node) {
var w, g *gui.Node
w = myGui.NewWindow("Setup Machine")
2023-04-12 12:21:23 -05:00
g = w.NewGroup("ssh things")
g.NewButton("ssh localhost", func() {
2023-04-12 12:21:23 -05:00
// ssh -t == force pseudo tty allocation
command = "ssh -t " + username + "@" + hostname + " 'ssh -v localhost'"
commandEntry.SetText(command)
})
g.NewButton("copy authorized_keys", func() {
2023-04-12 12:21:23 -05:00
command = "scp ~/jcarr/.ssh/authorized_keys " + username + "@[" + hostname + "]:.ssh" + "/"
commandEntry.SetText(command)
})
g.NewButton("sudo ssh localhost", func() {
2023-04-12 12:21:23 -05:00
// ssh -t == force pseudo tty allocation
command = "ssh -t " + username + "@" + hostname + " 'sudo ssh -v localhost'"
commandEntry.SetText(command)
})
g.NewButton("sudo cp authorized_keys", func() {
2023-04-12 12:21:23 -05:00
command = "ssh -t " + username + "@" + hostname + " 'sudo cp /home/jcarr/.ssh/authorized_keys /root/.ssh/ ' "
commandEntry.SetText(command)
})
g.NewLabel("install go 1.19")
g.NewButton("wget 1.19", func() {
2023-04-12 12:21:23 -05:00
command = "ssh -t " + "jcarr" + "@" + hostname + " 'wget https://go.dev/dl/go1.19.linux-amd64.tar.gz' "
xtermHold.SetChecked(true)
2023-04-12 12:21:23 -05:00
xterm(command)
})
g.NewLabel("install sid")
g.NewButton("replace /etc/apt/sources", func() {
2023-04-12 12:21:23 -05:00
commandEntry.SetText(command)
})
g.NewButton("apt update", func() {
2023-04-12 12:21:23 -05:00
// command = "ssh -t " + 'root' + "@" + hostname + " 'cp /home/jcarr/.ssh/authorized_keys /root/.ssh/ ' "
commandEntry.SetText(command)
})
g.NewLabel("build myself")
g.NewButton("setup go", func() {
2023-04-12 12:21:23 -05:00
// ssh -t == force pseudo tty allocation
command = "ssh -t " + "jcarr" + "@" + hostname + " 'go get -u -v go.wit.com/jcarr/control-panel-dns ; bash'"
2023-04-12 12:21:23 -05:00
commandEntry.SetText(command)
})
}