Make it possible to include extra external files into binary packages

This commit is contained in:
Jakob Borg 2015-01-07 16:15:50 +01:00
parent 1b6c700e18
commit 7d39d1a925
1 changed files with 21 additions and 11 deletions

View File

@ -226,15 +226,20 @@ func buildTar() {
build("./cmd/syncthing", tags) build("./cmd/syncthing", tags)
filename := name + ".tar.gz" filename := name + ".tar.gz"
files := []archiveFile{ files := []archiveFile{
{"README.md", name + "/README.txt"}, {src: "README.md", dst: name + "/README.txt"},
{"LICENSE", name + "/LICENSE.txt"}, {src: "LICENSE", dst: name + "/LICENSE.txt"},
{"AUTHORS", name + "/AUTHORS.txt"}, {src: "AUTHORS", dst: name + "/AUTHORS.txt"},
{"syncthing", name + "/syncthing"}, {src: "syncthing", dst: name + "/syncthing"},
{"syncthing.md5", name + "/syncthing.md5"}, {src: "syncthing.md5", dst: name + "/syncthing.md5"},
} }
for _, file := range listFiles("etc") { for _, file := range listFiles("etc") {
files = append(files, archiveFile{file, name + "/" + file}) files = append(files, archiveFile{src: file, dst: name + "/" + file})
} }
for _, file := range listFiles("extra") {
files = append(files, archiveFile{src: file, dst: name + "/" + filepath.Base(file)})
}
tarGz(filename, files) tarGz(filename, files)
log.Println(filename) log.Println(filename)
} }
@ -249,12 +254,17 @@ func buildZip() {
build("./cmd/syncthing", tags) build("./cmd/syncthing", tags)
filename := name + ".zip" filename := name + ".zip"
files := []archiveFile{ files := []archiveFile{
{"README.md", name + "/README.txt"}, {src: "README.md", dst: name + "/README.txt"},
{"LICENSE", name + "/LICENSE.txt"}, {src: "LICENSE", dst: name + "/LICENSE.txt"},
{"AUTHORS", name + "/AUTHORS.txt"}, {src: "AUTHORS", dst: name + "/AUTHORS.txt"},
{"syncthing.exe", name + "/syncthing.exe"}, {src: "syncthing.exe", dst: name + "/syncthing.exe"},
{"syncthing.exe.md5", name + "/syncthing.exe.md5"}, {src: "syncthing.exe.md5", dst: name + "/syncthing.exe.md5"},
} }
for _, file := range listFiles("extra") {
files = append(files, archiveFile{src: file, dst: name + "/" + filepath.Base(file)})
}
zipFile(filename, files) zipFile(filename, files)
log.Println(filename) log.Println(filename)
} }