attempt to add postinst

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-12 19:43:47 -05:00
parent 16f4ec5ac0
commit d460d8a686
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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)