-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GLUTEN-6537][BUILD] Support more shell environments beyond Bash in b…
…uild scripts
- Loading branch information
Showing
8 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
#! /bin/bash | ||
#!/bin/sh | ||
|
||
if [ -z "${BASH_SOURCE[0]}" ] || [ "$0" == "${BASH_SOURCE[0]}" ]; then | ||
echo "env.sh should only be sourced in bash" >&2 | ||
if [ -n "$BASH_VERSION" ]; then | ||
# Replace `$0` with `BASH_SOURCE[0]` in Bash because it returns the shell when using `source`. | ||
SCRIPT_PATH=${BASH_SOURCE[0]} | ||
else | ||
SCRIPT_PATH="$0" | ||
fi | ||
|
||
# source command does not start a new process, so the cmdline would not contains current script name. | ||
CMD=$(cat /proc/$$/cmdline) | ||
if [[ ${CMD} == *"$SCRIPT_PATH"* ]]; then | ||
echo "env.sh should only be sourced" >&2 | ||
exit 1 | ||
fi | ||
|
||
SCRIPT_ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" | ||
SCRIPT_ROOT="$(realpath "$(dirname "$SCRIPT_PATH")")" | ||
init_vcpkg_env=$("${SCRIPT_ROOT}/init.sh") | ||
eval "$init_vcpkg_env" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,7 @@ function check_commit { | |
} | ||
|
||
CURRENT_DIR=$( | ||
cd "$(dirname "$BASH_SOURCE")" | ||
cd "$(dirname $0)" | ||
pwd | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters