summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-12 19:43:47 -0500
committerJeff Carr <[email protected]>2024-10-12 19:43:47 -0500
commitd460d8a686ec8da1624499c2b930bf102ea2d9a2 (patch)
tree8f9e9b1b4eec7492bea50a37305bdb5b8a94cddf
parent16f4ec5ac09a375d3dfbebbcb166dbd41de2a68e (diff)
attempt to add postinstv0.22.1
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--Makefile3
-rw-r--r--buildPackage.go11
2 files changed, 11 insertions, 3 deletions
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)