summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controlBox.go4
-rw-r--r--md5sums2
-rw-r--r--stateWindow.go65
3 files changed, 69 insertions, 2 deletions
diff --git a/controlBox.go b/controlBox.go
index 4d3cec4..b25e91e 100644
--- a/controlBox.go
+++ b/controlBox.go
@@ -12,6 +12,7 @@ type controlFile struct {
Package *gadgets.OneLiner
Source *gadgets.OneLiner
+ Version *gadgets.OneLiner
Maintainer *gadgets.OneLiner
Architecture *gadgets.BasicDropdown
InstallPath *gadgets.BasicCombobox
@@ -34,6 +35,9 @@ func newControl(parent *gui.Node) *controlFile {
c.Source = gadgets.NewOneLiner(c.grid, "Source")
c.grid.NextRow()
+ c.Version = gadgets.NewOneLiner(c.grid, "Version")
+ c.grid.NextRow()
+
c.Architecture = gadgets.NewBasicDropdown(c.grid, "Architecture")
c.Architecture.AddText("riscv")
c.Architecture.AddText("amd64")
diff --git a/md5sums b/md5sums
new file mode 100644
index 0000000..95ee41a
--- /dev/null
+++ b/md5sums
@@ -0,0 +1,2 @@
+94c9b46e3e74ea492b1cc14db60aa4b2 ./usr/bin/go-deb
+070e03c58907970c10e3fa1f9a174877 ./usr/lib/go-deb/README.md
diff --git a/stateWindow.go b/stateWindow.go
index 5d88d8e..3fda09d 100644
--- a/stateWindow.go
+++ b/stateWindow.go
@@ -3,7 +3,9 @@
package main
import (
+ "fmt"
"os"
+ "strings"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
@@ -86,11 +88,50 @@ func (c *controlFile) buildPackage() bool {
}
arch := c.Architecture.String()
- version := "v0.0.0"
+ version := "0.0.0"
+ c.Version.SetText(version)
debname := filename + "_" + version + "_" + arch + ".deb"
- shell.Run([]string{"strip", filename})
+ if !shell.Mkdir("files/usr/bin") {
+ log.Warn("mkdir failed")
+ return false
+ }
+ if !shell.Mkdir("files/usr/lib/" + filename) {
+ log.Warn("mkdir failed")
+ return false
+ }
+ if shell.Exists("files/DEBIAN") {
+ if !shell.Run([]string{"rm", "-rf", "files/DEBIAN"}) {
+ log.Warn("rm failed")
+ return false
+ }
+ }
+ if shell.Exists("files/DEBIAN") {
+ log.Warn("rm failed")
+ return false
+ }
+ if !shell.Mkdir("files/DEBIAN") {
+ log.Warn("mkdir failed")
+ return false
+ }
+ if !shell.Run([]string{"cp", filename, "files/usr/bin"}) {
+ log.Warn("cp failed")
+ return false
+ }
+ if !shell.Run([]string{"strip", "files/usr/bin/" + filename}) {
+ log.Warn("strip failed")
+ return false
+ }
+ if !shell.Run([]string{"cp", "README.md", "files/usr/lib/" + filename}) {
+ log.Warn("cp failed")
+ return false
+ }
+ if !c.writeFiles() {
+ log.Warn("write control file failed")
+ return false
+ }
+
shell.Run([]string{"dpkg-deb", "--build", "files", debname})
if shell.Exists(debname) {
log.Warn("build worked")
@@ -100,3 +141,23 @@ func (c *controlFile) buildPackage() bool {
}
return true
}
+
+func (c *controlFile) writeFiles() 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)
+ return false
+ }
+ fmt.Fprintln(cf, "Package:", c.Package.String())
+ fmt.Fprintln(cf, "Source:", c.Source.String())
+ fmt.Fprintln(cf, "Version:", c.Version.String())
+ fmt.Fprintln(cf, "Architecture:", c.Architecture.String())
+ fmt.Fprintln(cf, "Depends:", c.Depends.String())
+ fmt.Fprintln(cf, "Build-Depends:", c.BuildDepends.String())
+ fmt.Fprintln(cf, "Maintainer:", c.Maintainer.String())
+ desc := c.Description.String()
+ parts := strings.Split(desc, "\n")
+ fmt.Fprintln(cf, "Description:", strings.Join(parts, " \n"))
+
+ return true
+}