Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ fi

# package versions
klayoutVersion=0.30.3
numThreads=$(nproc)
if [[ "$OSTYPE" == "darwin"* ]]; then
numThreads=$(sysctl -n hw.ncpu)
else
numThreads=$(nproc)
fi

_versionCompare() {
local a b IFS=. ; set -f
Expand Down
21 changes: 17 additions & 4 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ set -euo pipefail
# allow this script to be invoked from any folder
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [ $EUID -ne 0 ]; then
echo "This script must be run with sudo"
if [[ "$OSTYPE" == "darwin"* ]] && [[ $EUID -eq 0 ]]; then
echo "Do NOT run this script with sudo on macOS"
exit 1
fi

if [[ "$OSTYPE" != "darwin"* ]] && [[ $EUID -ne 0 ]]; then
echo "This script must be run with sudo on Linux"
exit 1
fi

Expand All @@ -17,7 +22,11 @@ tmpfile=$(mktemp)
git submodule status --recursive > "$tmpfile"

if grep -q "^-" "$tmpfile"; then
sudo -u $SUDO_USER git submodule update --init --recursive
if [[ "$OSTYPE" == "darwin"* ]]; then
git submodule update --init --recursive
else
sudo -u $SUDO_USER git submodule update --init --recursive
fi
elif grep -q "^+" "$tmpfile"; then
# Make it easy for users who are not hacking ORFS to do the right thing,
# run with current submodules, at the cost of having ORFS
Expand All @@ -27,4 +36,8 @@ elif grep -q "^+" "$tmpfile"; then
fi

"$DIR/etc/DependencyInstaller.sh" -base
sudo -u $SUDO_USER "$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"
if [[ "$OSTYPE" == "darwin"* ]]; then
"$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"
else
sudo -u $SUDO_USER "$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"
fi