forked from The-OpenROAD-Project/OpenROAD-flow-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·30 lines (24 loc) · 979 Bytes
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
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"
exit 1
fi
tmpfile=$(mktemp)
# any error messages from this command will stand out
# more clearly when run as a separate command rather than
# being piped
git submodule status --recursive > "$tmpfile"
if grep -q "^-" "$tmpfile"; then
sudo -u $SUDO_USER git submodule update --init --recursive
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
# hackers disable this test manually when hacking setup.sh
echo "Submodules are not up to date, run 'git submodule update --recursive' and try again"
exit 1
fi
"$DIR/etc/DependencyInstaller.sh" -base
sudo -u $SUDO_USER "$DIR/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"