diff --git a/Makefile b/Makefile index d913ece..2dfd1ac 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/buildPackage.go b/buildPackage.go index 8c18df1..3af7cfc 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -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/") } } diff --git a/main.go b/main.go index 990d6df..9831439 100644 --- a/main.go +++ b/main.go @@ -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)