setup ttyS0 might work

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-22 12:51:13 -05:00
parent 93f5386cb2
commit 063b4bc98b
11 changed files with 93 additions and 3 deletions

View File

@ -10,6 +10,7 @@ var args struct {
LogFile string
Verbose bool
User string `arg:"env:USER"`
TestExec string
gui.GuiArgs
}

27
main.go
View File

@ -1,8 +1,12 @@
package main
import (
"os"
"os/exec"
"log"
"embed"
"strings"
"bytes"
"git.wit.org/wit/gui"
)
@ -19,9 +23,32 @@ var geom string = "120x30+500+500"
//go:embed resources
var res embed.FS
//go:embed resources/ttyS0.conf
var ttyS0 string
func doCmd(str string) {
var stderr bytes.Buffer
log.Println("TestExec =", args.TestExec)
args := strings.Split(str, " ")
cmd := exec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = &stderr // os.Stderr
err := cmd.Run()
if err != nil {
log.Println("Error:", err)
}
log.Println("STDERR:\n", stderr.String())
}
func main() {
log.Println("starting my Control Panel")
if (args.TestExec != "") {
// for i, t := range args.Toolkit {
doCmd(args.TestExec)
os.Exit(0)
}
initGUI()
gui.Watchdog()
}

View File

@ -0,0 +1,5 @@
# sudo apt install -y apt-transport-https curl gnupg
# curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
# sudo mv bazel-archive-keyring.gpg /usr/share/keyrings
# deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8

View File

@ -0,0 +1,26 @@
# See https://wiki.debian.org/SourcesList for more information.
deb http://mirrors.lab.wit.org/debian sid main contrib non-free non-free-firmware
deb-src http://mirrors.lab.wit.org/debian sid main contrib non-free non-free-firmware
# deb http://mirrors.cogentco.com/debian sid main contrib non-free
# deb http://mirrors.kernel.org/debian sid main contrib non-free
# deb-src http://deb.debian.org/debian bullseye main
# deb http://deb.debian.org/debian bullseye-updates main
# deb-src http://deb.debian.org/debian bullseye-updates main
# deb http://security.debian.org/debian-security/ bullseye-security main
# deb-src http://security.debian.org/debian-security/ bullseye-security main
# See https://wiki.debian.org/SourcesList for more information.
#deb http://deb.debian.org/debian bullseye main
#deb-src http://deb.debian.org/debian bullseye main
#deb http://deb.debian.org/debian bullseye-updates main
#deb-src http://deb.debian.org/debian bullseye-updates main
#deb http://security.debian.org/debian-security/ bullseye-security main
#deb-src http://security.debian.org/debian-security/ bullseye-security main

View File

@ -0,0 +1 @@
# deb [signed-by=/etc/wit/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main

View File

@ -0,0 +1,3 @@
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
# deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main

View File

@ -0,0 +1 @@
# deb https://labs.picotech.com/picoscope7auto/debian/ picoscope main

View File

@ -0,0 +1,3 @@
# deb [arch=amd64 signed-by=/etc/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main
# deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/signal-keys.asc] https://updates.signal.org/desktop/apt xenial main
# deb-src [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/signal-keys.asc] https://updates.signal.org/desktop/apt xenial main

View File

@ -0,0 +1,2 @@
deb [signed-by=/etc/wit/wit.gpg] http://mirrors.wit.org/wit/ sid main
deb-src [signed-by=/etc/wit/wit.gpg] http://mirrors.wit.org/wit/ sid main

10
resources/ttyS0.conf Normal file
View File

@ -0,0 +1,10 @@
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
exec /sbin/getty -L 115200 ttyS0 vt102

View File

@ -3,6 +3,7 @@ import (
"log"
"time"
"os"
"io/ioutil"
"git.wit.org/wit/gui"
)
@ -10,7 +11,7 @@ var myGui *gui.Node
var mainWindow *gui.Node
func initGUI() {
myGui = gui.New()
myGui = gui.New().LoadToolkit("gocui")
mainWindow = myGui.NewWindow("wit new machine setup").SetText("wit new machine setup")
mainWindow.Custom = customExit
@ -54,8 +55,6 @@ func mainTab(n *gui.Node) {
/////////////////////////////////////////////////////////////////////////////
rn := newTab.NewGroup("Local Linux Settings")
rn.NewLabel("need to be run as root")
rn.NewButton("apt sources", func () {
xterm("cd ~/jcarr/setup; make setup-apt-sources; make setup-apt-file")
})
@ -69,6 +68,18 @@ func mainTab(n *gui.Node) {
xterm("cd ~/jcarr/setup; make setup-packages-kvm")
})
rn.NewButton("ttyS0", func () {
// systemctl enable serial-getty@ttyS0.service
// cp ttyS0.conf /etc/init/
foo := []byte(ttyS0)
ioutil.WriteFile("/etc/init/ttyS0.conf", foo, 0644)
myGui.CloseToolkit("gocui")
doCmd("ls -l")
doCmd("cat /etc/init/ttyS0.conf")
doCmd("systemctl enable serial-getty@ttyS0.service")
os.Exit(0)
})
rn.NewLabel("Not yet working stuff")
rn.NewButton("resolv.conf", func () {