Include etc dir in Unix builds

This commit is contained in:
Jakob Borg 2014-11-24 13:48:52 +01:00
parent 2e68ee5c8b
commit d9f79853fb

View File

@ -207,12 +207,16 @@ func buildTar() {
} }
build("./cmd/syncthing", tags) build("./cmd/syncthing", tags)
filename := name + ".tar.gz" filename := name + ".tar.gz"
tarGz(filename, []archiveFile{ files := []archiveFile{
{"README.md", name + "/README.txt"}, {"README.md", name + "/README.txt"},
{"LICENSE", name + "/LICENSE.txt"}, {"LICENSE", name + "/LICENSE.txt"},
{"AUTHORS", name + "/AUTHORS.txt"}, {"AUTHORS", name + "/AUTHORS.txt"},
{"syncthing", name + "/syncthing"}, {"syncthing", name + "/syncthing"},
}) }
for _, file := range listFiles("etc") {
files = append(files, archiveFile{file, name + "/" + file})
}
tarGz(filename, files)
log.Println(filename) log.Println(filename)
} }
@ -225,15 +229,30 @@ func buildZip() {
} }
build("./cmd/syncthing", tags) build("./cmd/syncthing", tags)
filename := name + ".zip" filename := name + ".zip"
zipFile(filename, []archiveFile{ files := []archiveFile{
{"README.md", name + "/README.txt"}, {"README.md", name + "/README.txt"},
{"LICENSE", name + "/LICENSE.txt"}, {"LICENSE", name + "/LICENSE.txt"},
{"AUTHORS", name + "/AUTHORS.txt"}, {"AUTHORS", name + "/AUTHORS.txt"},
{"syncthing.exe", name + "/syncthing.exe"}, {"syncthing.exe", name + "/syncthing.exe"},
}) }
zipFile(filename, files)
log.Println(filename) log.Println(filename)
} }
func listFiles(dir string) []string {
var res []string
filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
if err != nil {
return err
}
if fi.Mode().IsRegular() {
res = append(res, path)
}
return nil
})
return res
}
func setBuildEnv() { func setBuildEnv() {
os.Setenv("GOOS", goos) os.Setenv("GOOS", goos)
if strings.HasPrefix(goarch, "arm") { if strings.HasPrefix(goarch, "arm") {