package main // This should build the control panel correctly on each platform // Then, upload the binaries to mirrors.wit.com/cloud/control-panel import "log" import "fmt" import "time" import "os/user" import "git.wit.com/wit/shell" var filename string func main() { shell.Quiet(false) user, _ := user.Current() log.Println("user.HomeDir =", user.HomeDir) filename = shell.Execname("cloud-control-panel") // returns the right name for each OS 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.Md5sum(filename) log.Println("\tmd5sum =", md5sum) if (md5sum == "") { log.Println("\tBUILD FAILED") return } shell.Write("/tmp/build.md5sum", md5sum) }