parent
bf0863f4d0
commit
ec37a35d54
4
Makefile
4
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
|
||||
|
|
|
@ -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/")
|
||||
}
|
||||
}
|
||||
|
|
2
main.go
2
main.go
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue