10 Commits

Author SHA1 Message Date
DaanSelen 6f132eb589 chore: make it more verbose
Cross-Compile Binaries / compile-linux (push) Failing after 17m9s
Lint Golang Files / Golang-Lint (push) Successful in 17m27s
Cross-Compile Binaries / compile-windows (push) Has been cancelled
2026-04-02 12:20:44 +02:00
DaanSelen d2781c0247 chore: add silent checkbox 2026-04-02 11:48:23 +02:00
DaanSelen 2bd569d8f5 chore: change conditionals for trigger 2026-04-01 14:23:37 +02:00
DaanSelen 82f002d6e1 chore: bump submodule 2026-04-01 14:19:54 +02:00
DaanSelen e42fd43a9f chore: dependency update 2026-04-01 13:39:21 +02:00
DaanSelen 87a06d219b chore: bump deps 2026-04-01 13:36:31 +02:00
DaanSelen ac1700427f chore: update meshbook 2026-04-01 13:33:41 +02:00
DaanSelen 09b71a18cb chore: make the directory structure as wanted 2026-04-01 13:10:34 +02:00
DaanSelen 0d2d34e3fb core: readd runner.go 2026-04-01 12:24:02 +02:00
DaanSelen 50f022a303 chore: try old method 2026-04-01 12:23:49 +02:00
8 changed files with 49 additions and 103 deletions
+7 -3
View File
@@ -9,6 +9,7 @@ name: Cross-Compile Binaries
paths:
- 'src/**'
- 'go.**'
- 'meshbook/**'
schedule:
- cron: '0 0 * * 6'
@@ -83,7 +84,8 @@ jobs:
- name: move files for upload
run: |
mv ./meshbook ./meshbook-dir
mv ./dist/meshbook ./meshbook
mkdir ./bin
mv ./dist/meshbook ./bin/meshbook
- name: upload the building actifacts
uses: actions/upload-artifact@v7
@@ -91,7 +93,7 @@ jobs:
name: package-linux64
path: |
./patchworks
./meshbook
./bin/meshbook
retention-days: 7
overwrite: true
@@ -213,7 +215,8 @@ jobs:
- name: move files for upload
run: |
mv ./meshbook ./meshbook-dir
mv ./dist/meshbook.exe ./meshbook.exe
mkdir ./bin
mv ./dist/meshbook.exe ./bin/meshbook.exe
- name: upload the building actifacts
uses: actions/upload-artifact@v7
@@ -221,5 +224,6 @@ jobs:
name: package-win64
path: |
./*.exe
./bin/*.exe
retention-days: 7
overwrite: true
+4 -4
View File
@@ -32,9 +32,9 @@ require (
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
github.com/stretchr/testify v1.11.1 // indirect
github.com/yuin/goldmark v1.7.8 // indirect
golang.org/x/image v0.24.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/image v0.38.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.35.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+8 -8
View File
@@ -65,14 +65,14 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+3 -2
View File
@@ -35,9 +35,10 @@ func main() {
targEntry := widget.NewEntry()
var book string
var silent bool
inputContainer := draw.MakeInput(targEntry, &book)
footerContainer := draw.MakeFooter(targEntry, &book, app)
inputContainer := draw.MakeInput(targEntry, &book, &silent)
footerContainer := draw.MakeFooter(targEntry, &book, &silent, app)
center := container.NewBorder(
nil, // top
+12 -3
View File
@@ -13,15 +13,24 @@ import (
tasks "patchworks/src/modules/tasks"
)
func MakeInput(targEntry *widget.Entry, book *string) *fyne.Container {
func MakeInput(targEntry *widget.Entry, book *string, silent *bool) *fyne.Container {
availBooks, err := tasks.ListAvailableBooks()
if err != nil {
log.Println("failed to read available books on disk")
}
silentCheck := widget.NewCheck("Silent (Return Only JSON Data)", func(checked bool) {
if checked {
*silent = true
} else {
*silent = false
}
})
targetBox := container.NewVBox(
widget.NewLabel("MeshCentral Target Group"),
targEntry,
silentCheck,
widget.NewLabel(""),
canvas.NewLine(color.Gray{Y: 128}),
)
@@ -55,7 +64,7 @@ func MakeInput(targEntry *widget.Entry, book *string) *fyne.Container {
return inputBox
}
func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Container {
func MakeFooter(targEntry *widget.Entry, book *string, silent *bool, app fyne.App) *fyne.Container {
var result string
textEntry := widget.NewMultiLineEntry()
@@ -89,7 +98,7 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
log.Println("kicking off goroutine")
actionBtn.Disable()
go func() {
ok, result = runner.RunMeshbook(path, *book, targEntry.Text)
ok, result = runner.RunMeshbook(path, *book, *silent, targEntry.Text)
if !ok {
log.Println("assuming failed state")
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
@@ -1,6 +1,3 @@
//go:build windows
// +build windows
package runner
import (
@@ -9,7 +6,6 @@ import (
"os/exec"
"regexp"
"runtime"
"syscall"
)
var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`)
@@ -49,29 +45,38 @@ func FindMeshbookBinary() (bool, string) {
}
}
func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
func RunMeshbook(binPath, bookPath string, silent bool, targGroup string) (bool, string) {
// Meshbook argument compilation
var args []string
if len(bookPath) == 0 {
args = []string{"--help"}
} else {
args = []string{"--nograce", "--indent", "-mb", bookPath, "--group", targGroup}
}
log.Printf("running with parameters: %v", args)
cmd := exec.Command(binPath, args...)
cmd.SysProcAttr = &syscall.SysProcAttr{
HideWindow: true,
if silent {
args = append(args, "--silent")
}
// Display what we are about to be running
log.Printf("running with parameters: %v", args)
// Actually spawn the process
cmd := exec.Command(binPath, args...)
// Capture stdout & stderr
outputData, err := cmd.CombinedOutput()
cleanData := ansi.ReplaceAllString(string(outputData), "")
log.Println("evaluating returned state")
if err != nil {
log.Printf("something went wrong when running the command: %v", err)
log.Printf("captured output: %s", cleanData)
return false, cleanData
} else {
log.Printf("captured output: %s", cleanData)
return true, cleanData
}
}
-73
View File
@@ -1,73 +0,0 @@
//go:build linux
// +build linux
package runner
import (
"log"
"os"
"os/exec"
"regexp"
"runtime"
)
var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`)
func FindMeshbookBinary() (bool, string) {
var osBin string
switch runtime.GOOS {
case "windows":
osBin = "meshbook.exe"
case "linux":
osBin = "meshbook"
default:
log.Println("undefined operating system")
}
log.Println("going to search for:", osBin)
binaryFound := false
var binaryPath string
for _, f := range []string{("./" + osBin), ("./bin/" + osBin)} {
objInfo, err := os.Stat(f)
if err == nil && objInfo.Mode().IsRegular() {
binaryFound = true
binaryPath = f
log.Printf("found binary at %s", f)
break
}
}
if binaryFound {
return true, binaryPath
} else {
log.Println("binary not found!")
return false, ""
}
}
func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
var args []string
if len(bookPath) == 0 {
args = []string{"--help"}
} else {
args = []string{"--nograce", "--indent", "-mb", bookPath, "--group", targGroup}
}
log.Printf("running with parameters: %v", args)
cmd := exec.Command(binPath, args...)
outputData, err := cmd.CombinedOutput()
cleanData := ansi.ReplaceAllString(string(outputData), "")
if err != nil {
log.Printf("something went wrong when running the command: %v", err)
log.Printf("captured output: %s", cleanData)
return false, cleanData
} else {
return true, cleanData
}
}