Skip to content

Commit 98baadd

Browse files
committed
Follow existing coding style
Signed-off-by: Sahil Jaiswal <[email protected]>
1 parent 53e89d3 commit 98baadd

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

setup.sh

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@ set -euo pipefail
55
# allow this script to be invoked from any folder
66
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
77

8-
# macOS detection
9-
IS_DARWIN=false
10-
if [[ "$(uname)" == "Darwin" ]]; then
11-
IS_DARWIN=true
12-
fi
13-
14-
if $IS_DARWIN && [[ $EUID -eq 0 ]]; then
8+
if [[ "$OSTYPE" == "darwin"* ]] && [[ $EUID -eq 0 ]]; then
159
echo "Do NOT run this script with sudo on macOS"
1610
exit 1
1711
fi
1812

19-
if ! $IS_DARWIN && [[ $EUID -ne 0 ]]; then
13+
if [[ "$OSTYPE" != "darwin"* ]] && [[ $EUID -ne 0 ]]; then
2014
echo "This script must be run with sudo on Linux"
2115
exit 1
2216
fi
@@ -28,7 +22,7 @@ tmpfile=$(mktemp)
2822
git submodule status --recursive > "$tmpfile"
2923

3024
if grep -q "^-" "$tmpfile"; then
31-
if $IS_DARWIN; then
25+
if [[ "$OSTYPE" == "darwin"* ]]; then
3226
git submodule update --init --recursive
3327
else
3428
sudo -u $SUDO_USER git submodule update --init --recursive
@@ -42,7 +36,7 @@ elif grep -q "^+" "$tmpfile"; then
4236
fi
4337

4438
"$DIR/etc/DependencyInstaller.sh" -base
45-
if $IS_DARWIN; then
39+
if [[ "$OSTYPE" == "darwin"* ]]; then
4640
"$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"
4741
else
4842
sudo -u $SUDO_USER "$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"

0 commit comments

Comments
 (0)