wit-new-machine/setup.go

60 lines
1.7 KiB
Go

package main
import (
"git.wit.org/wit/gui"
)
// setup a new machine
var command string
var commandEntry *gui.Node
func setupNewMachine(cur *gui.Node) {
var w, g *gui.Node
w = cur.NewTab("Setup Machine")
g = w.NewGroup("ssh things")
g.NewButton("ssh localhost", func () {
// ssh -t == force pseudo tty allocation
command = "ssh -t " + username + "@" + hostname + " 'ssh -v localhost'"
commandEntry.SetText(command)
})
g.NewButton("copy authorized_keys", func () {
command = "scp ~/jcarr/.ssh/authorized_keys " + username + "@[" + hostname + "]:.ssh" + "/"
commandEntry.SetText(command)
})
g.NewButton("sudo ssh localhost", func () {
// 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 () {
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 () {
command = "ssh -t " + "jcarr" + "@" + hostname + " 'wget https://go.dev/dl/go1.19.linux-amd64.tar.gz' "
xtermHold.Set(true)
xterm(command)
})
g.NewLabel("install sid")
g.NewButton("replace /etc/apt/sources", func () {
commandEntry.SetText(command)
})
g.NewButton("apt update", func () {
// 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 () {
// ssh -t == force pseudo tty allocation
command = "ssh -t " + "jcarr" + "@" + hostname + " 'go get -u -v git.wit.org/jcarr/control-panel-dns ; bash'"
commandEntry.SetText(command)
})
}