diff --git a/Makefile b/Makefile index b0e340d..a72669c 100644 --- a/Makefile +++ b/Makefile @@ -68,3 +68,6 @@ build-releases: -go-deb --release --no-gui --repo go.wit.com/apps/go.wit.com -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 diff --git a/buildPackage.go b/buildPackage.go index 3e511d2..2fcfd32 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -91,8 +91,10 @@ func (c *controlBox) buildPackage() (bool, error) { return false, errors.New("rm files/") } } + shell.Run([]string{"sync"}) // for some reason the next check fails sometimes? if shell.Exists("files") { - log.Warn("rm failed") + // probably the 'shell' package id being stupid and not waiting for the process to actually exit + log.Warn("rm failed. files/ still exists. is golang doing these in parallel?") return false, errors.New("rm files/") } if !shell.Mkdir("files/DEBIAN") { @@ -131,9 +133,12 @@ func (c *controlBox) buildPackage() (bool, error) { } } - if !c.writeFiles() { + if !c.writeDebianControlFile() { return false, errors.New("write control file") } + if shell.Exists("postinst") { + shell.Run([]string{"cp", "postinst", "files/DEBIAN/"}) + } // experiment for the toolkit package // if the git repo has a "./build" script run it before packaging @@ -166,7 +171,7 @@ func (c *controlBox) buildPackage() (bool, error) { return true, nil } -func (c *controlBox) writeFiles() bool { +func (c *controlBox) writeDebianControlFile() bool { cf, err := os.OpenFile("files/DEBIAN/control", os.O_RDWR|os.O_CREATE, 0644) if err != nil { log.Info("open control file failed", err)