somewhat better

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-06 16:22:41 -06:00
parent bf0863f4d0
commit ec37a35d54
3 changed files with 12 additions and 8 deletions

View File

@ -75,5 +75,5 @@ build-releases:
-go-deb --release --no-gui --repo go.wit.com/apps/helloworld
-go-deb --release --no-gui --repo go.wit.com/apps/go-deb
debian:
./go-deb --no-gui --repo go.wit.com/apps/go-deb
debian: build
./go-deb --no-gui --keep-files --repo go.wit.com/apps/go-deb

View File

@ -43,6 +43,7 @@ func (c *controlBox) buildPackage() (bool, error) {
debname := filename + "_" + version + "_" + arch + ".deb"
fulldebname := filepath.Join(homeDir, "incoming", debname)
if shell.Exists(fulldebname) {
log.Info("debian package already built: " + fulldebname)
return true, errors.New("debian package already built: " + fulldebname)
}
@ -76,6 +77,7 @@ func (c *controlBox) buildPackage() (bool, error) {
// add some standard golang flags
vldflag := "-X main.VERSION=" + version
gldflag := "-X main.GUIVERSION=" + version // todo: git this from the filesystem
// timeflag := "-X main.BUILDTIME='${BUILDTIME}'"
cmd = append(cmd, "-ldflags", vldflag)
cmd = append(cmd, "-ldflags", gldflag)
@ -97,8 +99,9 @@ func (c *controlBox) buildPackage() (bool, error) {
}
if shell.Exists("files") {
if shell.Run([]string{"rm", "-rf", "files"}) {
log.Warn("rm failed")
shell.Run([]string{"rm", "-rf", "files"})
if shell.Exists("files") {
log.Warn("rm failed for some reason")
return false, errors.New("rm files/")
}
}
@ -181,8 +184,9 @@ func (c *controlBox) buildPackage() (bool, error) {
if argv.KeepFiles {
log.Info("keeping the build files/")
} else {
if shell.Run([]string{"rm", "-rf", "files"}) {
log.Warn("rm failed")
shell.Run([]string{"rm", "-rf", "files"})
if shell.Exists("files") {
log.Warn("rm -rf files/ failed. Run() returned false")
return false, errors.New("rm files/")
}
}

View File

@ -32,7 +32,7 @@ func main() {
os.Exit(0)
}
myGui = gui.New()
if ! argv.NoGui {
if !argv.NoGui {
myGui.InitEmbed(resources)
myGui.Default()
}
@ -67,7 +67,7 @@ func main() {
shell.TestTerminalColor()
// basicWindow.Show() // broken gui package. convert to protobuf
if ok, err := cBox.buildPackage(); ok {
log.Info("build worked")
log.Info("build worked before. remove the .deb file to recreate it")
} else {
log.Warn("build failed:", err)
os.Exit(-1)