Add lint for [ instead of [[ in shells scripts

This commit is contained in:
Aneesh Agrawal 2016-08-05 09:42:04 -04:00
parent 9231ca1c69
commit f07d8f188a
5 changed files with 17 additions and 8 deletions

View file

@ -8,25 +8,25 @@ set -o errexit
set -o nounset
set -o pipefail
if [ ${#} -eq 0 ]; then
if [[ ${#} -eq 0 ]]; then
echo "Usage: ${0} /path/to/gecko/objdir [other-regen.py-flags]"
exit 1
fi
# Check for rust-bindgen
if [ ! -d rust-bindgen ]; then
if [[ ! -d rust-bindgen ]]; then
echo "rust-bindgen not found. Run setup_bindgen.sh first."
exit 1
fi
# Check for /usr/include
if [ ! -d /usr/include ]; then
if [[ ! -d /usr/include ]]; then
echo "/usr/include doesn't exist." \
"Mac users may need to run xcode-select --install."
exit 1
fi
if [ "$(uname)" == "Linux" ]; then
if [[ "$(uname)" == "Linux" ]]; then
LIBCLANG_PATH=/usr/lib/llvm-3.8/lib
else
LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"

View file

@ -12,14 +12,14 @@ set -o pipefail
cd "$(dirname ${0})"
# Setup and build bindgen.
if [ "$(uname)" == "Linux" ]; then
if [[ "$(uname)" == "Linux" ]]; then
export LIBCLANG_PATH=/usr/lib/llvm-3.8/lib
else
export LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
# Make sure we have llvm38.
if [ ! -x "$(command -v clang-3.8)" ]; then
if [[ ! -x "$(command -v clang-3.8)" ]]; then
echo "llmv38 must be installed." \
"Mac users should |brew install llvm38|, Linux varies by distro."
exit 1
@ -29,13 +29,13 @@ export LD_LIBRARY_PATH="${LIBCLANG_PATH}"
export DYLD_LIBRARY_PATH="${LIBCLANG_PATH}"
# Check for multirust
if [ ! -x "$(command -v multirust)" ]; then
if [[ ! -x "$(command -v multirust)" ]]; then
echo "multirust must be installed."
exit 1
fi
# Don't try to clone twice.
if [ ! -d rust-bindgen ]; then
if [[ ! -d rust-bindgen ]]; then
git clone https://github.com/servo/rust-bindgen.git
fi