-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_unball.sh
executable file
·88 lines (75 loc) · 2.48 KB
/
setup_unball.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
RED='\033[0;31m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
repos=(
# ieee-very-small
Firmware
communication
# control
# measurement_system
# strategy
# system
main_system
python_simulator
# python_vision
)
check_repos(){
printf "\n${BLUE} Checking for packages existence${NO_COLOR}"
declare -a argAry=("${!1}")
clonestr='git clone https://github.com/unball/'
for i in "${argAry[@]}"
do
if [[ ! -d "$i" ]] ; then
printf "${GREEN} Cloning repo $i${NO_COLOR}\n"
$clonestr$i.git
else
printf "${BLUE} $i already cloned ${NO_COLOR}\n"
fi
done
}
download_simulator(){
printf "\n${BLUE}Downloading the unball simulator${NO_COLOR}\n\n"
mkdir ~/unball/simulator
cd ~/unball/simulator
# Download latest version from Google Drive
wget -O "unball_simulator.tar.gz" "https://drive.google.com/uc?export=download&id=0BwlvQGynHcxZTTdPUnF3dGR0MlE"
# Extract downloaded version, overwriting files
tar -xzf "unball_simulator.tar.gz" --overwrite
}
configure_catkin(){
declare -a argAry=("${!1}")
printf "\n${BLUE}Setting up catkin workspace at catkin_ws_unball${NO_COLOR}\n\n"
mkdir -p ~/catkin_ws_unball
cd ~/catkin_ws_unball
mkdir -p src
catkin_make
for i in "${argAry[@]}"
do
if [[ ! -e "src/"$i ]]; then
ln -s ~/unball/$i ~/catkin_ws_unball/src/$i
fi
done
cp ${ORIGINAL_DIRECTORY}/run_strategy_and_pythonsimulator.sh ~/catkin_ws_unball/
cp ${ORIGINAL_DIRECTORY}/update_all_repos.sh ~/catkin_ws_unball/
cp ${ORIGINAL_DIRECTORY}/status_all_repos.sh ~/catkin_ws_unball/
chmod 777 ${ORIGINAL_DIRECTORY}/run_strategy_and_pythonsimulator.sh
if [[ -e /usr/bin/run_strategy_and_pythonsimulator ]]; then
sudo rm /usr/bin/run_strategy_and_pythonsimulator
fi
sudo ln -s ~/catkin_ws_unball/run_strategy_and_pythonsimulator.sh /usr/bin/run_strategy_and_pythonsimulator
printf "${GREEN}Copying desktop entry\n${NO_COLOR}"
sudo cp ${ORIGINAL_DIRECTORY}/unball.png /usr/local/etc
sudo cp ${ORIGINAL_DIRECTORY}/unball.desktop ~/.local/share/applications/
sudo cp ${ORIGINAL_DIRECTORY}/unball.desktop /usr/share/applications/
catkin_make
printf "\n${BLUE}Setup complete! This folder may now be deleted if you wish.${NO_COLOR}\n"
}
ORIGINAL_DIRECTORY=$PWD
cd ~
if [[ ! -d "~/unball" ]]; then
mkdir -p ~/unball
fi
cd ~/unball
check_repos repos[@]
configure_catkin repos[@]