Skip to content

Commit 7409609

Browse files
committed
Add a guard to requirements installer for checking OS type
1 parent 40fb015 commit 7409609

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

install-requirements.sh

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
#!/bin/bash
22
set -e
33

4-
# install requirements
5-
export DEBIAN_FRONTEND=noninteractive
6-
apt-get -y update
7-
apt-get -y install \
8-
cmake \
9-
g++-7 \
10-
git \
11-
python3-dev \
12-
python3-numpy \
13-
sudo \
14-
wget
4+
if [[ "$OSTYPE" == "linux-gnu" ]]; then
5+
# install requirements
6+
export DEBIAN_FRONTEND=noninteractive
7+
apt-get -y update
8+
apt-get -y install \
9+
cmake \
10+
g++-7 \
11+
git \
12+
python3-dev \
13+
python3-numpy \
14+
sudo \
15+
wget
1516

16-
# install bazel
17-
export BAZEL_VERSION=${BAZEL_VERSION:-`cat ./Dockerfiles/BAZEL_VERSION`}
18-
apt-get -y install pkg-config zip g++ zlib1g-dev unzip python
19-
bazel_installer=bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
20-
wget -P /tmp https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${bazel_installer}
21-
chmod +x /tmp/${bazel_installer}
22-
/tmp/${bazel_installer}
23-
rm /tmp/${bazel_installer}
17+
# install bazel
18+
export BAZEL_VERSION=${BAZEL_VERSION:-`cat ./Dockerfiles/BAZEL_VERSION`}
19+
apt-get -y install pkg-config zip g++ zlib1g-dev unzip python
20+
bazel_installer=bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
21+
wget -P /tmp https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${bazel_installer}
22+
chmod +x /tmp/${bazel_installer}
23+
/tmp/${bazel_installer}
24+
rm /tmp/${bazel_installer}
2425

25-
if [[ ${BUILD_WITH_CUDA:-"OFF"} == "ON" ]]; then
26-
# install libcupti
27-
apt-get -y install cuda-command-line-tools-10-1
26+
if [[ ${BUILD_WITH_CUDA:-"OFF"} == "ON" ]]; then
27+
# install libcupti
28+
apt-get -y install cuda-command-line-tools-10-1
29+
fi
30+
31+
else
32+
echo "This script supports only Debian-based operating systems (like Ubuntu)." \
33+
"Please consult README file for manual installation on your '$OSTYPE' OS."
34+
exit 1
2835
fi

0 commit comments

Comments
 (0)