cloud-control-panel/build/build.go

50 lines
1.0 KiB
Go

package main
// This should build and upload the binary to mirrors
// upload binary to mirrors.wit.com/cloud/control-panel
import "log"
import "fmt"
import "time"
// import "github.com/davecgh/go-spew/spew"
import "git.wit.com/wit/shell"
// import "os/user"
// import "io/ioutil"
// github.com/bramvdbogaerde/go-scp
var filename string
var builddir string
func main() {
filename := "cloud-control-panel"
// shell.Quiet(true)
shell.Quiet(false)
gitref := shell.Run("git rev-list -1 HEAD")
// setup the files that will end up in the binary
epoch := fmt.Sprintf("%d", time.Now().Unix())
shell.Write("./resources/BUILDDATE", epoch)
shell.Write("./resources/BUILDREF", gitref)
// rebuild the binary (always remove the old one
shell.Run("rm " + filename)
shell.Run("packr build")
log.Println("build finished")
/*
md5sum = shell.Run("md5sum " + filename)
log.Println("\tmd5sum =", md5sum)
if (md5sum == "") {
log.Println("\tBUILD FAILED")
b = false
return &b
}
shell.Write("/tmp/autobuild.md5sum", md5sum)
*/
}