summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-11 13:56:59 -0600
committerJeff Carr <[email protected]>2024-02-11 13:56:59 -0600
commit0322b3ad856345c1e3c848e06c8d27caee6856af (patch)
treea32575c22a298ea1d4919c2a8802cd2b8df2194f
parente4e12ae90dd2f9775b1d45c1d083a4e44817a655 (diff)
builds automatically
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--Makefile2
-rw-r--r--addRepo.go1
-rw-r--r--args.go7
-rw-r--r--main.go35
-rw-r--r--stateWindow.go16
5 files changed, 39 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 49cf377..b434bfb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
.PHONY: debian
run: build
- ./go-deb --open-gui
+ ./go-deb --no-gui --repo go.wit.com/apps/control-panel-dns
dns: build
./go-deb --repo go.wit.com/apps/control-panel-dns
diff --git a/addRepo.go b/addRepo.go
index 1a25dc9..7fd9994 100644
--- a/addRepo.go
+++ b/addRepo.go
@@ -52,7 +52,6 @@ func (c *controlBox) addRepo(path string) {
c.status.SetUserWorkingName("jcarr")
c.status.Update()
-
cbname := c.status.GetCurrentBranchName()
cbversion := c.status.GetCurrentBranchVersion()
debversion := strings.TrimPrefix(cbversion, "v")
diff --git a/args.go b/args.go
index 35b272b..58be509 100644
--- a/args.go
+++ b/args.go
@@ -13,9 +13,10 @@ import (
)
var args struct {
- TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
- OpenGui bool `arg:"--open-gui" help:"open the go-deb gui"`
- Repo string `arg:"--repo" help:"go get path to the repo"`
+ TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
+ NoGui bool `arg:"--no-gui" help:"don't open the gui, just make the .deb"`
+ Repo string `arg:"--repo" help:"go get path to the repo"`
+ PkgDir string `arg:"--pkg-dir" help:"set default directory (~/incoming/)"`
}
func init() {
diff --git a/main.go b/main.go
index 55101d4..5ebdc7b 100644
--- a/main.go
+++ b/main.go
@@ -20,6 +20,12 @@ var cBox *controlBox
var basicWindow *gadgets.BasicWindow
func main() {
+ if args.Repo == "" {
+ log.Info("You need to tell me what repo you want to work on")
+ println("")
+ println("go-deb --repo go.wit.com/apps/helloworld")
+ os.Exit(0)
+ }
if debugger.ArgDebug() {
log.SetAll(true)
log.ShowFlags()
@@ -33,20 +39,18 @@ func main() {
basicWindow = makebasicWindow()
- if args.Repo != "" {
- filepath := filepath.Join("/home/jcarr/go/src", args.Repo)
- os.Chdir(filepath)
+ filepath := filepath.Join("/home/jcarr/go/src", args.Repo)
+ os.Chdir(filepath)
- cBox.addRepo(args.Repo)
- cBox.readControlFile()
- basicWindow.Show()
- // go will sit here until the window exits
- gui.Watchdog()
- }
- if args.OpenGui {
- basicWindow.Show()
- // go will sit here until the window exits
- gui.Watchdog()
+ cBox.addRepo(args.Repo)
+ cBox.readControlFile()
+ if args.NoGui {
+ if cBox.buildPackage() {
+ log.Info("build worked")
+ } else {
+ log.Warn("build failed")
+ }
+ os.Exit(0)
}
// run the debugger if triggered from the commandline
@@ -56,4 +60,9 @@ func main() {
debugger.DebugWindow()
}()
}
+
+ basicWindow.Show()
+ // go will sit here until the window exits
+ gui.Watchdog()
+ os.Exit(0)
}
diff --git a/stateWindow.go b/stateWindow.go
index efe9a8a..9f9f166 100644
--- a/stateWindow.go
+++ b/stateWindow.go
@@ -5,6 +5,7 @@ package main
import (
"fmt"
"os"
+ "path/filepath"
"strings"
"go.wit.com/lib/gadgets"
@@ -125,15 +126,22 @@ func (c *controlBox) buildPackage() bool {
return false
}
- shell.Run([]string{"dpkg-deb", "--build", "files", debname})
- if shell.Exists(debname) {
+ homeDir, err := os.UserHomeDir()
+ if err != nil {
+ log.Warn("os.UserHomeDir() failed")
+ return false
+ }
+
+ fulldebname := filepath.Join(homeDir, "incoming", debname)
+ shell.Run([]string{"dpkg-deb", "--build", "files", fulldebname})
+ if shell.Exists(fulldebname) {
log.Warn("build worked")
} else {
log.Warn("build failed")
return false
}
- shell.Run([]string{"dpkg-deb", "-I", debname})
- shell.Run([]string{"dpkg-deb", "-c", debname})
+ shell.Run([]string{"dpkg-deb", "-I", fulldebname})
+ shell.Run([]string{"dpkg-deb", "-c", fulldebname})
return true
}