@@ -5,8 +5,13 @@ set -euo pipefail
55# allow this script to be invoked from any folder
66DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
77
8- if [ $EUID -ne 0 ]; then
9- echo " This script must be run with sudo"
8+ if [[ " $OSTYPE " == " darwin" * ]] && [[ $EUID -eq 0 ]]; then
9+ echo " Do NOT run this script with sudo on macOS"
10+ exit 1
11+ fi
12+
13+ if [[ " $OSTYPE " != " darwin" * ]] && [[ $EUID -ne 0 ]]; then
14+ echo " This script must be run with sudo on Linux"
1015 exit 1
1116fi
1217
@@ -17,7 +22,11 @@ tmpfile=$(mktemp)
1722git submodule status --recursive > " $tmpfile "
1823
1924if grep -q " ^-" " $tmpfile " ; then
20- sudo -u $SUDO_USER git submodule update --init --recursive
25+ if [[ " $OSTYPE " == " darwin" * ]]; then
26+ git submodule update --init --recursive
27+ else
28+ sudo -u $SUDO_USER git submodule update --init --recursive
29+ fi
2130elif grep -q " ^+" " $tmpfile " ; then
2231 # Make it easy for users who are not hacking ORFS to do the right thing,
2332 # run with current submodules, at the cost of having ORFS
@@ -27,4 +36,8 @@ elif grep -q "^+" "$tmpfile"; then
2736fi
2837
2938" $DIR /etc/DependencyInstaller.sh" -base
30- sudo -u $SUDO_USER " $DIR /etc/DependencyInstaller.sh" -common -prefix=" $DIR /dependencies"
39+ if [[ " $OSTYPE " == " darwin" * ]]; then
40+ " $DIR /etc/DependencyInstaller.sh" -common -prefix=" $DIR /dependencies"
41+ else
42+ sudo -u $SUDO_USER " $DIR /etc/DependencyInstaller.sh" -common -prefix=" $DIR /dependencies"
43+ fi
0 commit comments