next thing to do is generate the md5sums file
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
3740ef9834
commit
2df4dc135a
|
@ -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")
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
94c9b46e3e74ea492b1cc14db60aa4b2 ./usr/bin/go-deb
|
||||
070e03c58907970c10e3fa1f9a174877 ./usr/lib/go-deb/README.md
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue