From feaee26c2db3d33b035bcbb0abb82c69d132d600 Mon Sep 17 00:00:00 2001 From: Dan McGregor Date: Tue, 29 Nov 2016 07:41:27 -0600 Subject: [PATCH] Don't hardcode /bin/bash Some platforms either don't have bash installed as /bin/bash. Use the environment to find it in the PATH. Change-Id: Ie1a6d64146927c83af07d0e2ca7f573c7504f8ef --- polygerrit-ui/app/run_test.sh | 2 +- polygerrit-ui/run-server.sh | 2 +- tools/bzl/js.bzl | 2 +- tools/maven/api.sh | 4 +++- tools/maven/package.bzl | 3 ++- tools/workspace-status.sh | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/polygerrit-ui/app/run_test.sh b/polygerrit-ui/app/run_test.sh index 95d30e5e48..d17a530862 100755 --- a/polygerrit-ui/app/run_test.sh +++ b/polygerrit-ui/app/run_test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash wct_bin=$(which wct) if [[ -z "$wct_bin" ]]; then diff --git a/polygerrit-ui/run-server.sh b/polygerrit-ui/run-server.sh index 603d34a76b..cbe3563e02 100755 --- a/polygerrit-ui/run-server.sh +++ b/polygerrit-ui/run-server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (C) 2015 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tools/bzl/js.bzl b/tools/bzl/js.bzl index 7acf382410..788301c15d 100644 --- a/tools/bzl/js.bzl +++ b/tools/bzl/js.bzl @@ -105,7 +105,7 @@ def _bower_archive(ctx): ]), False) def _bash(ctx, cmd): - cmd_list = ["/bin/bash", "-c", cmd] + cmd_list = ["bash", "-c", cmd] out = ctx.execute(cmd_list) if out.return_code: fail("failed %s: %s" % (" ".join(cmd_list), out.stderr)) diff --git a/tools/maven/api.sh b/tools/maven/api.sh index 92fc0dd50c..8c441fb9c4 100755 --- a/tools/maven/api.sh +++ b/tools/maven/api.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/usr/bin/env bash # Copyright (C) 2015 The Android Open Source Project # @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +set -e + if [[ "$#" != "1" ]] ; then cat < $@", + "echo '#!/usr/bin/env bash' > $@", "echo \"# this script should run from the root of your workspace.\" >> $@", + "echo \"set -e\" >> $@", "echo \"\" >> $@", "echo 'if [[ \"$$VERBOSE\" ]]; then set -x ; fi' >> $@", "echo \"\" >> $@", diff --git a/tools/workspace-status.sh b/tools/workspace-status.sh index 1ef91b8ca2..4c8b7f6dcb 100755 --- a/tools/workspace-status.sh +++ b/tools/workspace-status.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script will be run by bazel when the build process starts to # generate key-value information that represents the status of the