Skip to content

Commit

Permalink
Deployer now includes os specific bash 4.x, extracts to .deps/bin upo…
Browse files Browse the repository at this point in the history
…n start

Fixes GH issue hortonworks#14
  • Loading branch information
lalyos committed Apr 14, 2015
1 parent 4d7300c commit faef4df
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
Binary file added .deps/bin/bash-darwin
Binary file not shown.
Binary file added .deps/bin/bash-linux
Binary file not shown.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

### Fixed

- Bash 4.3 is included in the binary, extracted into .deps/bin upon start

### Added

### Removed
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Expand Up @@ -11,15 +11,16 @@ else
FLAGS="-X main.Version $(VERSION) -X main.GitRevision $(GIT_BRANCH)-$(GIT_REV)"
endif

build:
go-bindata include
build: bindata
mkdir -p build/Linux && GOOS=linux go build -ldflags $(FLAGS) -o build/Linux/$(BINARYNAME)
mkdir -p build/Darwin && GOOS=darwin go build -ldflags $(FLAGS) -o build/Darwin/$(BINARYNAME)

dev:
go-bindata include
dev: bindata
go build -ldflags $(FLAGS) -o /usr/local/bin/$(BINARYNAME)

bindata:
go-bindata include .deps/bin

install: build
install build/$(shell uname -s)/$(BINARYNAME) /usr/local/bin

Expand Down
14 changes: 3 additions & 11 deletions deployer.go
Expand Up @@ -9,8 +9,7 @@ import (
"io"
"log"
"os"
"os/exec"
"strings"
"runtime"

"github.com/progrium/go-basher"
)
Expand Down Expand Up @@ -46,15 +45,8 @@ func application(
loader func(string) ([]byte, error),
copyEnv bool) {

var bashPath string
bashPath, err := exec.LookPath("bash")
if err != nil {
if strings.Contains(os.Getenv("SHELL"), "bash") {
bashPath = os.Getenv("SHELL")
} else {
bashPath = "/bin/bash"
}
}
bashPath := ".deps/bin/bash-" + runtime.GOOS
RestoreAsset(".", bashPath)
bash, err := basher.NewContext(bashPath, os.Getenv("DEBUG") != "")

bash.Export("DEBUG", os.Getenv("DEBUG"))
Expand Down

0 comments on commit faef4df

Please sign in to comment.