From 860f852df9b83f9225e0457249ca086027e6b900 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 1 Aug 2019 01:47:59 -0600 Subject: [PATCH] set exec bits --- build-all.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build-all.go b/build-all.go index c8ef782..d6eebc7 100644 --- a/build-all.go +++ b/build-all.go @@ -107,7 +107,7 @@ func main() { nfile := fmt.Sprintf("%s.%s", npath, pkg.ext) // TODO check remote filesize anyway as a quick sanity check nurl := fmt.Sprintf("https://nodejs.org/download/release/v%s/%s", nodev, nfile) - err = download("node package", nurl, nfile) + err = download("node package", nurl, nfile, false) if nil != err { panic(err) } @@ -168,7 +168,7 @@ func main() { arch, ) pathmanFile := filepath.Join(outdir, "bin", "pathman") + pkg.exe - err = download("pathman", pathmanURL, pathmanFile) + err = download("pathman", pathmanURL, pathmanFile, true) if nil != err { panic(err) } @@ -180,7 +180,7 @@ func main() { arch, ) servicemanFile := filepath.Join(outdir, "bin", "serviceman") + pkg.exe - err = download("serviceman", servicemanURL, servicemanFile) + err = download("serviceman", servicemanURL, servicemanFile, true) if nil != err { panic(err) } @@ -189,7 +189,7 @@ func main() { fmt.Printf("Done.\n") } -func download(title string, nurl string, nfile string) error { +func download(title string, nurl string, nfile string, exec bool) error { if _, err := os.Stat(nfile); nil == err { return nil } @@ -206,7 +206,11 @@ func download(title string, nurl string, nfile string) error { // Stream it in locally fmt.Printf("Streaming %s to %s\n", nurl, nfile) - nf, err := os.OpenFile(nfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + fmode := os.FileMode(0644) + if exec { + fmode = os.FileMode(0755) + } + nf, err := os.OpenFile(nfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, fmode) _, err = io.Copy(nf, resp.Body) if nil != err { return err