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.
This commit is contained in:
Родитель
8774031d5e
Коммит
b2834b58bf
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
|
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
|
||||||
# archive and extract a certain branch of a git repository into a target directory.
|
# archive and extract a certain branch of a git repository into a target directory.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
|
||||||
RUBOCOP_YML="${DIR}/.rubocop.yml"
|
RUBOCOP_YML="${DIR}/.rubocop.yml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script is being invoked via <root dir>/.git/hooks, hence the
|
# This script is being invoked via <root dir>/.git/hooks, hence the
|
||||||
# base directory is up two levels, not just one.
|
# base directory is up two levels, not just one.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script exists to make it easier to test alternate branches of octocatalog-diff.
|
# This script exists to make it easier to test alternate branches of octocatalog-diff.
|
||||||
# It is intended as a one-for-one replacement of `octocatalog-diff` as installed by the gem.
|
# It is intended as a one-for-one replacement of `octocatalog-diff` as installed by the gem.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script echoes back the environment. This is used for spec testing
|
# This script echoes back the environment. This is used for spec testing
|
||||||
# and possible debugging.
|
# and possible debugging.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
|
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
|
||||||
# archive and extract a certain branch of a git repository into a target directory.
|
# archive and extract a certain branch of a git repository into a target directory.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Script to run Puppet. The default implementation here is simply to pass
|
# Script to run Puppet. The default implementation here is simply to pass
|
||||||
# through the command line arguments (which are likely to be numerous when
|
# through the command line arguments (which are likely to be numerous when
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# For test purposes only, this script would ordinarily run a git checkout, but here
|
# For test purposes only, this script would ordinarily run a git checkout, but here
|
||||||
# it's going to generate a directory structure by copying some other fixture.
|
# it's going to generate a directory structure by copying some other fixture.
|
||||||
|
|
|
@ -71,10 +71,11 @@ describe OctocatalogDiff::Bootstrap do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should execute bootstrap script with PATH matching environment' do
|
it 'should execute bootstrap script with PATH matching environment' do
|
||||||
ENV['PATH'] = @d + '/adslfk'
|
old_path = ENV['PATH']
|
||||||
|
ENV['PATH'] = "#{old_path}:#{@d + '/adslfk'}"
|
||||||
result = b(path: @d, bootstrap_script: 'script/bootstrap.sh', bootstrap_args: 'PATH')
|
result = b(path: @d, bootstrap_script: 'script/bootstrap.sh', bootstrap_args: 'PATH')
|
||||||
expect(result[:status_code]).to eq(32)
|
expect(result[:status_code]).to eq(32)
|
||||||
expect(result[:output].strip).to eq(@d + '/adslfk')
|
expect(result[:output].strip).to eq("#{old_path}:#{@d + '/adslfk'}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should execute bootstrap script with BASEDIR matching argument' do
|
it 'should execute bootstrap script with BASEDIR matching argument' do
|
||||||
|
|
|
@ -183,7 +183,7 @@ module OctocatalogDiff
|
||||||
temp_repo_dir = Dir.mktmpdir
|
temp_repo_dir = Dir.mktmpdir
|
||||||
Dir.mkdir(File.join(temp_repo_dir, 'script'))
|
Dir.mkdir(File.join(temp_repo_dir, 'script'))
|
||||||
File.open(File.join(temp_repo_dir, 'script', filename), 'w') do |f|
|
File.open(File.join(temp_repo_dir, 'script', filename), 'w') do |f|
|
||||||
f.write "#!/bin/bash\n"
|
f.write "#!/usr/bin/env bash\n"
|
||||||
f.write "var=\"${@: -1}\"\n"
|
f.write "var=\"${@: -1}\"\n"
|
||||||
f.write "if [ \"$var\" = \"\" ]; then exit 31; fi\n"
|
f.write "if [ \"$var\" = \"\" ]; then exit 31; fi\n"
|
||||||
f.write "eval answer=\\$$var\n"
|
f.write "eval answer=\\$$var\n"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче