-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·103 lines (84 loc) · 3.44 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
#
# Copyright (c) 2019 Gary Kim <gary@garykim.dev>
# Licensed under GPL-3.0-only License
#
# Easily run this script by running
# `curl -sSL --output chernobotinstaller.sh https://raw.githubusercontent.com/sas-mate-robotics/chernobot/master/install.sh && grep '#!/bin/bash' chernobotinstaller.sh > /dev/null && bash ./chernobotinstaller.sh dl`
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
# Fix XCode command line tools install check
# Do not check
echo -e 'Detected Darwin (macOS) OS\n'
# # Check if c++ compiler is installed
# type c++ > /dev/null || echo -e 'There is no C++ compiler avaliable on your computer.\nIf you would like to install one, run this command\nxcode-select --install\nthen rerun this script\n' && exit 1
# Check if Homebrew is installed
hash brew > /dev/null || (echo -e 'Homebrew is not installed\nIf you would like to install it, run this command\n/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"\nthen rerun this script.\n' && exit 1)
echo 'Homebrew detected'
# # Check if git is avaliable
# type git > /dev/null || echo -e 'Git is not installed\nIf you would like to install it, run this command\nbrew install git\nthen rerun this script.\n' && exit 1
# Check if XCode developer tools are installed.
xcode-select -p || (echo -e 'XCode Developer tools are not installed. Please run this command\nxcode-select --install\nthen rerun this script\n' && exit 1)
echo -e 'XCode Developer Tools detected'
if [[ "$1" == "dl" ]] || [[ "$1" == "download" ]]; then
git clone --recursive https://github.com/sas-mate-robotics/chernobot.git chernobot
cd chernobot
brew install sdl2 ninja cmake opencv
mkdir -p tmp
cd tmp
cmake -G Ninja ..
ninja install
cd ..
elif [[ "$1" == "update" ]]; then
git pull
git submodule update --init --recursive
mkdir -p tmp
cd tmp
cmake -G Ninja ..
ninja install
cd ..
else
mkdir -p tmp
cd tmp
cmake -G Ninja ..
ninja install
cd ..
fi
echo -e 'Chernobot has been installed. You should find a file named "chernobot" in the chernobot folder.'
exit 0
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
echo -e "Detected GNU/Linux OS\n"
if [ "$(cat /etc/os-release | grep -icP '(ID_LIKE=ubuntu|ID=ubuntu)')" != 1 ]; then
echo -e 'Unfortunatly, there is not support for your distro. Currently, only Ubuntu and Ubuntu deriviatives are supported\n'
exit 1
fi
if [[ "$1" == "dl" ]] || [[ "$1" == "download" ]]; then
git clone --recursive https://github.com/sas-mate-robotics/chernobot.git chernobot
cd chernobot
sudo -E apt update && sudo -E apt install -y cmake ninja-build libsdl2-dev libopencv* libavdevice-dev
mkdir -p tmp
cd tmp
cmake -G Ninja ..
ninja install
cd ..
elif [[ "$1" == "update" ]]; then
git pull
git submodule update --init --recursive
mkdir -p tmp
cd tmp
cmake -G Ninja ..
ninja install
cd ..
else
mkdir -p tmp
cd tmp
cmake -G Ninja ..
ninja install
cd ..
fi
echo -e 'Chernobot has been installed. You should find a file named "chernobot" in the chernobot folder.'
exit 0
else
echo -e "OS not recognized\n"
exit 1
fi