build: NSIS based Windows installer (#3240)

This commit adds support for creating Windows installers to ci.go
This commit is contained in:
Péter Szilágyi
2016-11-08 23:55:39 +02:00
committed by Felix Lange
parent 6707f70b4a
commit 9bc97a5785
9 changed files with 632 additions and 9 deletions

View File

@ -20,6 +20,7 @@ import (
"bytes"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
@ -117,3 +118,25 @@ func render(tpl *template.Template, outputFile string, outputPerm os.FileMode, x
log.Fatal(err)
}
}
// CopyFile copies a file.
func CopyFile(dst, src string, mode os.FileMode) {
if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
log.Fatal(err)
}
destFile, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode)
if err != nil {
log.Fatal(err)
}
defer destFile.Close()
srcFile, err := os.Open(src)
if err != nil {
log.Fatal(err)
}
defer srcFile.Close()
if _, err := io.Copy(destFile, srcFile); err != nil {
log.Fatal(err)
}
}