-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_esrocos
executable file
·164 lines (131 loc) · 4.47 KB
/
install_esrocos
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#! /bin/sh
# URLs to install from GitHub
#CONF_URL=https://github.com/ESROCOS/buildconf.git
#AUTOPROJ_CONFIG_URL=https://raw.githubusercontent.com/ESROCOS/buildconf/master/config.yml
#AUTOPROJ_BOOTSTRAP_URL=https://rock-robotics.org/master/autoproj_bootstrap
#DOWNLOAD_AUTOPROJ_CONFIG=true
# URLs to install from GMV's GitLab
CONF_URL=https://github.com/ESROCOS/buildconf.git
AUTOPROJ_CONFIG_URL=$(realpath $(dirname $0))/config.yml
AUTOPROJ_BOOTSTRAP_URL=$(realpath $(dirname $0))/autoproj_bootstrap
DOWNLOAD_AUTOPROJ_CONFIG=false
# DOWNLOAD_AUTOPROJ_CONFIG indicates that the autoproj files can be downloaded from a public repo
# When using a private repo, the files must be copied from a local path instead
if test $DOWNLOAD_AUTOPROJ_CONFIG != true ; then
if ! test -f $AUTOPROJ_CONFIG_URL; then
echo "config.yml not found in the same directory as install_esrocos"
exit 1
fi
if ! test -f $AUTOPROJ_BOOTSTRAP_URL; then
echo "autoproj_bootstrap not found in the same directory as install_esrocos"
exit 1
fi
fi
#Which ESROCOS buildconf branch to check out
if [[ -z $ESROCOS_BRANCH ]]; then
ESROCOS_BRANCH="master"
fi
echo "checking out branch: $ESROCOS_BRANCH"
RUBY=ruby
BOOTSTRAP_ARGS=
set -e
mkdir -p ~/esrocos_workspace/.autoproj
cd ~/esrocos_workspace
if ! which $RUBY > /dev/null 2>&1; then
echo "cannot find the ruby executable. On Ubuntu 16.04 and above, you should run"
echo " sudo apt-get install ruby"
echo "or on Ubuntu 14.04"
echo " sudo apt-get install ruby2.0"
exit 1
fi
RUBY_VERSION_VALID=`$RUBY -e 'STDOUT.puts RUBY_VERSION.to_f >= 2.0'`
if [ "x$RUBY_VERSION_VALID" != "xtrue" ]; then
if test "$RUBY_USER_SELECTED" = "1"; then
echo "You selected $RUBY as the ruby executable, and it is not providing Ruby >= 2.0"
else
cat <<EOMSG
ruby --version reports
`$RUBY --version`
The supported version for Rock is ruby >= 2.0. I don't know if you have it
installed, and if you do what name it has. You will have to select a Ruby
executable by passing it on the command line, as e.g.
sh bootstrap.sh ruby2.1
EOMSG
exit 1
fi
fi
# test if ruby-dev was installed
if ! dpkg --get-selections | grep -q "ruby.*-dev"; then
echo -e "\e[93mRuby has been installed, but you might need the development headers, too. You should run"
echo -e " \e[93msudo apt-get install ruby2.3-dev\e[39m"
exit 1
else
echo "ruby-dev installed"
fi
# FINALLY NO MORE RUBY
# DOWNLOAD AUTOPROJ
if which wget > /dev/null; then
DOWNLOADER=wget
elif which curl > /dev/null; then
DOWNLOADER=curl
else
echo "I can find neither curl nor wget, either install one of these or"
echo "download the following script yourself, and re-run this script"
exit 1
fi
if ! test -f $PWD/autoproj_bootstrap; then
if $DOWNLOAD_AUTOPROJ_CONFIG = true ; then
$DOWNLOADER $AUTOPROJ_BOOTSTRAP_URL
else
cp $AUTOPROJ_BOOTSTRAP_URL .
fi
fi
# DECIDES HOW TO DOWNLOAD STUFF
CONF_URL=${CONF_URL#*//}
CONF_SITE=${CONF_URL%%/*}
CONF_REPO=${CONF_URL#*/}
GET_REPO=https://$CONF_SITE/$CONF_REPO
PUSH_TO=$GET_REPO
until [ -n "$GET_REPO" ]
do
echo -n "Which protocol do you want to use to access $CONF_REPO on $CONF_SITE? [git|ssh|http] (default: ssh) "
read ANSWER
ANSWER=`echo $ANSWER | tr "[:upper:]" "[:lower:]"`
case "$ANSWER" in
"ssh"|"")
GET_REPO=git@$CONF_SITE:$CONF_REPO ;;
"http")
GET_REPO=https://$CONF_SITE/$CONF_REPO ;;
"git")
GET_REPO=git://$CONF_SITE/$CONF_REPO ;;
esac
PUSH_TO=${GET_REPO}
done
# DECIDES HOW TO DOWNLOAD STUFF
until [ -n "$ESROCOS_BRANCH" ]
do
echo -n "Which version do you want to install? [master|stable|<other branch>] (default: master) "
read ANSWER
ANSWER=`echo $ANSWER | tr "[:upper:]" "[:lower:]"`
case "$ANSWER" in
"master"|"") ESROCOS_BRANCH="master" ;;
"stable") ESROCOS_BRANCH="stable" ;;
*) ESROCOS_BRANCH=$ANSWER ;;
esac
done
# DOWNLOAD AUTOPROJ STUFF
cd ~/esrocos_workspace/.autoproj
if $DOWNLOAD_AUTOPROJ_CONFIG = true ; then
$DOWNLOADER $AUTOPROJ_CONFIG_URL
else
cp $AUTOPROJ_CONFIG_URL .
fi
cd ..
echo "checking out $BRANCH"
export AUTOPROJ_BOOTSTRAP_IGNORE_NONEMPTY_DIR=1
$RUBY autoproj_bootstrap $@ git $GET_REPO push_to=$PUSH_TO $BOOTSTRAP_ARGS branch=$ESROCOS_BRANCH
# SOURCE Autoproj envs, update, resolve dependencies and build
if test "x$@" != "xlocaldev"; then
echo "source env.sh"
$SHELL -c '. $PWD/env.sh; autoproj update; autoproj osdeps; autoproj build'
fi