From d79b8810dc870cc51374e923160c6edd81fc370a Mon Sep 17 00:00:00 2001 From: Emiel Wiedijk Date: Tue, 10 Jul 2018 19:50:23 +0200 Subject: [PATCH 1/3] Check for $GOPATH The shell script in interfacer/contrib/setup_go.sh expands the $GOPATH variable to download a script to $GOPATH/bin. However, if $GOPATH is not set, that expands to /bin. If the script is run with root privileges (accidentally), this will download a "strange" executable to /bin, which is supposed to be for system executables. If it is run without root privileges, it gives an (unclear) error about permissions. This commit checks if $GOPATH exists. If it $GOPATH does not exist, it exits with error code 1. --- interfacer/contrib/setup_go.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interfacer/contrib/setup_go.sh b/interfacer/contrib/setup_go.sh index a546083c..401a1e78 100755 --- a/interfacer/contrib/setup_go.sh +++ b/interfacer/contrib/setup_go.sh @@ -4,6 +4,12 @@ set -e # Install `dep` the current defacto dependency for Golang GOLANG_DEP_VERSION=0.3.2 dep_url=https://github.com/golang/dep/releases/download/v$GOLANG_DEP_VERSION/dep-linux-amd64 + +if [ -z $GOPATH ]; then + echo '$GOPATH is not set, aborting' + exit 1 +fi + curl -L -o $GOPATH/bin/dep $dep_url chmod +x $GOPATH/bin/dep From 78b021f822344f08554d045f79c50909cf4de8cb Mon Sep 17 00:00:00 2001 From: traBpUkciP Date: Tue, 10 Jul 2018 15:49:25 -0300 Subject: [PATCH 2/3] Add Support for 64 bit Firefox Installations (#87) Should fix up #87 and all the other related issues. Haven't wrote any golang for a year but I think it was a pretty simple fix so I took it on; however ff someone wouldn't mind giving it a second set of eyes that would be awesome. I'm stoked to try the app out, it's looks so cool :P Cheers --- interfacer/src/browsh/firefox.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interfacer/src/browsh/firefox.go b/interfacer/src/browsh/firefox.go index 2287b45c..98c27cb6 100644 --- a/interfacer/src/browsh/firefox.go +++ b/interfacer/src/browsh/firefox.go @@ -104,7 +104,14 @@ func ensureFirefoxBinary() { } } if _, err := os.Stat(*firefoxBinary); os.IsNotExist(err) { - Shutdown(errors.New("Firefox binary not found: " + *firefoxBinary)) + if runtime.GOOS == "windows" { + *firefoxBinary = `c:\Program Files\Mozilla Firefox\firefox.exe` + if _, err := os.Stat(*firefoxBinary); os.IsNotExist(err) { + Shutdown(errors.New("Firefox binary not found in: " + *firefoxBinary + " or c:\Program Files (x86)\Mozilla Firefox\firefox.exe")) + } + } else { + Shutdown(errors.New("Firefox binary not found: " + *firefoxBinary)) + } } } From a3b8c05b604a9abaa794500b7f0561e8a61a3673 Mon Sep 17 00:00:00 2001 From: traBpUkciP Date: Tue, 10 Jul 2018 16:13:14 -0300 Subject: [PATCH 3/3] Use Backticks to Wrap String With Slashes Oops. Quick fix. --- interfacer/src/browsh/firefox.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfacer/src/browsh/firefox.go b/interfacer/src/browsh/firefox.go index 98c27cb6..c1370909 100644 --- a/interfacer/src/browsh/firefox.go +++ b/interfacer/src/browsh/firefox.go @@ -107,7 +107,7 @@ func ensureFirefoxBinary() { if runtime.GOOS == "windows" { *firefoxBinary = `c:\Program Files\Mozilla Firefox\firefox.exe` if _, err := os.Stat(*firefoxBinary); os.IsNotExist(err) { - Shutdown(errors.New("Firefox binary not found in: " + *firefoxBinary + " or c:\Program Files (x86)\Mozilla Firefox\firefox.exe")) + Shutdown(errors.New(`Firefox binary not found in: c:\Program Files (x86)\Mozilla Firefox\firefox.exe or ` + *firefoxBinary)) } } else { Shutdown(errors.New("Firefox binary not found: " + *firefoxBinary))