Skip to content

Commit b2834b5

Browse files
committed
Do not hardcode /bin/bash
Bash location is different from /bin on most non-Linux UNIX systems. Rely on env(1) to find the shell in the user's $PATH.
1 parent 8774031 commit b2834b5

File tree

11 files changed

+13
-12
lines changed

11 files changed

+13
-12
lines changed

examples/script-overrides/git-extract-submodules/git-extract.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
44
# archive and extract a certain branch of a git repository into a target directory.

script/fmt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
44
RUBOCOP_YML="${DIR}/.rubocop.yml"

script/git-pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script is being invoked via <root dir>/.git/hooks, hence the
44
# base directory is up two levels, not just one.

script/octocatalog-diff-wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script exists to make it easier to test alternate branches of octocatalog-diff.
44
# It is intended as a one-for-one replacement of `octocatalog-diff` as installed by the gem.

script/puppet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
44

scripts/env/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script echoes back the environment. This is used for spec testing
44
# and possible debugging.

scripts/git-extract/git-extract.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
44
# archive and extract a certain branch of a git repository into a target directory.

scripts/puppet/puppet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Script to run Puppet. The default implementation here is simply to pass
44
# through the command line arguments (which are likely to be numerous when

spec/octocatalog-diff/fixtures/override-scripts/git-extract.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# For test purposes only, this script would ordinarily run a git checkout, but here
44
# it's going to generate a directory structure by copying some other fixture.

spec/octocatalog-diff/tests/bootstrap_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ def b(options = {})
7171
end
7272

7373
it 'should execute bootstrap script with PATH matching environment' do
74-
ENV['PATH'] = @d + '/adslfk'
74+
old_path = ENV['PATH']
75+
ENV['PATH'] = "#{old_path}:#{@d + '/adslfk'}"
7576
result = b(path: @d, bootstrap_script: 'script/bootstrap.sh', bootstrap_args: 'PATH')
7677
expect(result[:status_code]).to eq(32)
77-
expect(result[:output].strip).to eq(@d + '/adslfk')
78+
expect(result[:output].strip).to eq("#{old_path}:#{@d + '/adslfk'}")
7879
end
7980

8081
it 'should execute bootstrap script with BASEDIR matching argument' do

0 commit comments

Comments
 (0)