-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·50 lines (45 loc) · 1.54 KB
/
install.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
# detect os: https://unix.stackexchange.com/a/6348
if type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
echo $OS:$VER
if ! [ "$OS" == "Ubuntu" ] || ! [ "$VER" == "18.04" ]; then
echo "Not running on Ubuntu 18.04. GCC 5.5.0 will not be installed."
exit 0
fi
# install dependencies
sudo apt-get install -y libreadline-dev
sudo apt-get install -y libedit-dev
# install GCC 5.5.0 on Ubuntu 18.04
if hash gcc && gcc --version | grep "5.5.0"; then
echo "GCC 5.5.0 already installed."
exit 0
fi
sudo apt update && sudo apt install -y gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
if gcc --version | grep "5.5.0"; then
echo "GCC 5.5.0 installed successfully."
else
echo "ERROR: Install GCC 5.5.0 failed."
exit 1
fi
# install valgrind
# sudo apt install -y valgrind
exit 0