-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathinstall_sumo.sh
executable file
·66 lines (52 loc) · 1.95 KB
/
install_sumo.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
#!/bin/bash
# Script to install SUMO on Ubuntu 20.04 and Mint 20.3
current_dir="$(pwd)"
# Get install dir from input if it exists
if [ $# -gt 0 ]; then
install_dir="$1/INSTALLDIR"
else
install_dir="$(pwd)/INSTALLDIR"
fi
echo "Creating install directory..."
mkdir -p "$install_dir"
cd "$install_dir"
echo "Downloading SUMO from larosterna website..."
if [ ! -e "$install_dir/sumo-standalone-Qt4-2.7.9.tgz" ]; then
wget https://www.larosterna.com/packages/sumo-standalone-Qt4-2.7.9.tgz
fi
tar zxvf sumo-standalone-Qt4-2.7.9.tgz
echo "Adding missing librairies..."
echo "--> libgortran3"
if ! grep "ethz.ch/ubuntu/" /etc/apt/sources.list ; then
sudo -- bash -c 'echo "deb http://ubuntu.ethz.ch/ubuntu/ bionic universe" >> /etc/apt/sources.list'
sudo -- bash -c 'echo "deb http://ubuntu.ethz.ch/ubuntu/ bionic-updates universe" >> /etc/apt/sources.list'
fi
sudo apt-get update -y
sudo apt-get install -y libgfortran3
echo "--> libpng12"
sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update -y
sudo apt install -y libpng12-0
echo "--> libglu"
sudo apt install -y libglu1-mesa
echo "--> xvfb"
sudo apt install -y xvfb
echo "Set Tetgen path in dwfsumo.conf..."
if [ ! -e "~/.config/larosterna/dwfsumo.conf" ]; then
mkdir -p ~/.config/larosterna
echo "[General]" >> ~/.config/larosterna/dwfsumo.conf
echo "tetgenpath=$install_dir/sumo-2.7.9/bin/tetgen" >> ~/.config/larosterna/dwfsumo.conf
else
if ! grep "tetgenpath" ~/.config/larosterna/dwfsumo.conf ; then
echo "tetgenpath=$install_dir/sumo-2.7.9/bin/tetgen" >> ~/.config/larosterna/dwfsumo.conf
else
sed -i "s|tetgenpath.*|tetgenpath=$install_dir/sumo-2.7.9/bin/tetgen|" ~/.config/larosterna/dwfsumo.conf
fi
fi
# Add sumo to PATH in bashrc
sumo_run_path="$install_dir"/sumo-2.7.9/bin
echo \# SUMO Path >> ~/.bashrc
echo export SUMO_RUN=\""$sumo_run_path"\" >> ~/.bashrc
echo export PATH=\"\$PATH:\$SUMO_RUN\" >> ~/.bashrc
source ~/.bashrc
cd "$current_dir"