From d9f79853fb8eb389537789ca74745c304112c1a4 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 24 Nov 2014 13:48:52 +0100 Subject: [PATCH] Include etc dir in Unix builds --- build.go | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/build.go b/build.go index 2429ed6fd..80232b212 100644 --- a/build.go +++ b/build.go @@ -207,12 +207,16 @@ func buildTar() { } build("./cmd/syncthing", tags) filename := name + ".tar.gz" - tarGz(filename, []archiveFile{ + files := []archiveFile{ {"README.md", name + "/README.txt"}, {"LICENSE", name + "/LICENSE.txt"}, {"AUTHORS", name + "/AUTHORS.txt"}, {"syncthing", name + "/syncthing"}, - }) + } + for _, file := range listFiles("etc") { + files = append(files, archiveFile{file, name + "/" + file}) + } + tarGz(filename, files) log.Println(filename) } @@ -225,15 +229,30 @@ func buildZip() { } build("./cmd/syncthing", tags) filename := name + ".zip" - zipFile(filename, []archiveFile{ + files := []archiveFile{ {"README.md", name + "/README.txt"}, {"LICENSE", name + "/LICENSE.txt"}, {"AUTHORS", name + "/AUTHORS.txt"}, {"syncthing.exe", name + "/syncthing.exe"}, - }) + } + zipFile(filename, files) 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() { os.Setenv("GOOS", goos) if strings.HasPrefix(goarch, "arm") {