forked from AlexanderSilvaB/Mari
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup
executable file
·94 lines (86 loc) · 2.67 KB
/
setup
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
#!/bin/bash
echo "Rinobot CodeRelease Setup"
echo ""
if [[ $EUID -eq 0 ]]; then
echo "This script must not be run as root" 1>&2
exit 1
fi
echo "Installing required packages"
sudo apt-get install cmake libnss-mdns avahi-discover avahi-utils sshpass unzip python2.7 python-pip
sudo pip install qibuild
toolchain="rinobot-robot"
local_toolchain="rinobot-local"
for i in "$@"; do
if [ "$#" -gt 0 -a $i != "--local" ]; then
toolchain=$1
fi
done
if [ ! -d ".qi" ]; then
echo ""
echo "Initializing qibuild"
qibuild init
fi
echo ""
echo "Installing SDK's"
if [ ! -d "sdk" ]; then
echo "Creating SDK Folder"
echo "Place a SDK file (ctc-linuxXX-atom-X.X.X.XX.zip) inside the sdk folder and run this script again"
else
count=$(ls -l sdk/ | grep .zip | egrep -c '^-')
if [ $count = 0 ]; then
echo "No SDK found"
echo "Place a SDK file (ctc-linuxXX-atom-X.X.X.XX.zip) inside the sdk folder and run this script again"
exit 1
elif [ $count -gt 1 ]; then
echo "More than one SDK found"
exit 1
else
selected=$(ls -1 sdk/ | grep .zip)
echo "SDK Found: $selected"
echo "Extracting"
unzip -qq -n sdk/$selected -d sdk/
echo "Creating toolchain $toolchain"
filename="${selected%.*}"
qitoolchain create $toolchain sdk/$filename/toolchain.xml
echo "Adding config"
qibuild add-config $toolchain -t $toolchain
echo "Installed as $toolchain"
echo "You are now able to build and sync to the robot as:"
echo "./build $toolchain"
echo "./sync robot-hostname $toolchain"
fi
fi
for arg in "$@"
do
if [ "$arg" == "--local" ]
then
echo "Configuring a Local SDK"
echo "Installing a local SDK"
if [ ! -d "sdk" ]; then
echo "Creating SDK Folder"
echo "Place a SDK file (naoqi-sdk-2.1.4.13-linux64.tar.gz) inside the sdk folder and run this script again"
else
counter=$(ls -l sdk/ | grep .tar.gz | egrep -c '^-')
if [ $counter = 0 ]; then
echo "No naoqi-sdk found"
echo "Place a SDK file (naoqi-sdk-2.1.4.13-linux64.tar.gz) inside the sdk folder and run this script again"
exit 1
elif [ $counter -gt 1 ]; then
echo "More than one SDK found"
exit 1
else
selected=$(ls -1 sdk/ | grep .tar.gz)
echo "naoqi-sdk Found: $selected"
echo "Extracting"
tar -xvzf sdk/$selected -C sdk/
echo "Creating local toolchain $local_toolchain"
filename="${selected%.*}"
sdk_filename="${filename%.*}"
qitoolchain create $local_toolchain sdk/$sdk_filename/toolchain.xml
echo "Adding config"
qibuild add-config $local_toolchain -t $local_toolchain
echo "Installed as $local_toolchain"
fi
fi
fi
done