-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.sh
executable file
·69 lines (56 loc) · 1.32 KB
/
configure.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
OS_TYPE=$(uname -s)
echo "Operating System: $OS_TYPE"
if [ "$OS_TYPE" = "Linux" ]; then
# Linux type
if [ -f /etc/os-release ]; then
. /etc/os-release
OS_NAME=$ID
OS_VERSION=$VERSION_ID
# sudo needed
case $OS_NAME in
ubuntu|debian)
apt install g++|| {
exit 1
}
apt install make
apt install cmake
apt install libboost-filesystem-dev
apt install libboost-test-dev
apt install libboost-regex-dev
;;
*)
echo "configure.sh only support ubuntu|debian"
exit 1
;;
esac
else
echo "/etc/os-release not found."
exit 1
fi
elif [ "$OS_TYPE" = "Darwin" ]; then
if ! command -v brew &> /dev/null; then
read -p "Homebrew not found. Do you want to install it?[y/n]: " yn
if [[ "$yn" =~ ^[Nn]$ ]]; then
echo "exit"
exit 1
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
fi
brew install gcc
brew install make
brew install cmake
brew install boost
else
echo "NOT SUPPORTED OS: $OS_TYPE"
#exit 1
fi
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd -P)
cd "$SCRIPT_DIR"
if [ "$EUID" -ne 0 ]; then
mkdir build
else
sudo -u $SUDO_USER mkdir -p build
fi
exit 1