-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_esrocos
118 lines (89 loc) · 2.9 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
#!/usr/bin/env sh
CONF_URL=${CONF_URL:=https://github.com/ESROCOS/build-conf.git}
RUBY=ruby
AUTOPROJ_BOOTSTRAP_URL=http://rock-robotics.org/master/autoproj_bootstrap
BOOTSTRAP_ARGS=
mkdir -p ~/esrocos_workspace
cd ~/esrocos_workspace
# RUBY RUBY RUBY
if test -n "$1" && test "$1" != "dev" && test "$1" != "localdev"; then
RUBY=$1
shift 1
RUBY_USER_SELECTED=1
fi
set -e
# MORE RUBY
if ! which $RUBY > /dev/null 2>&1; then
echo "cannot find the ruby executable. On ubuntu, you should run"
echo " sudo apt-get install ruby2.1"
echo "or on Ubuntu 14.04"
echo " sudo apt-get install ruby2.0"
exit 1
fi
# EVEN MORE RUBY
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
# FINALLY NO MORE RUBY
# DOWNLOAD AUTOPROJ
if ! test -f $PWD/autoproj_bootstrap; then
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
$DOWNLOADER $AUTOPROJ_BOOTSTRAP_URL
fi
# DECIDES HOW TO DOWNLOAD STUFF
CONF_URL=${CONF_URL#*//}
CONF_SITE=${CONF_URL%%/*}
CONF_REPO=${CONF_URL#*/}
PUSH_TO=git@$CONF_SITE:$CONF_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
done
# DECIDES HOW TO DOWNLOAD STUFF
BRANCH=""
until [ -n "$BRANCH" ]
do
echo -n "Which version do you want to install? [master|monolithic] (default: master) "
read ANSWER
ANSWER=`echo $ANSWER | tr "[:upper:]" "[:lower:]"`
case "$ANSWER" in
"master"|"") BRANCH="master" ;;
"monolithic") BRANCH="monolithic_asn" ;;
esac
done
# DOWNLOAD AUTOPROJ STUFF
echo "checking out $BRANCH"
$RUBY autoproj_bootstrap $@ git $GET_REPO push_to=$PUSH_TO $BOOTSTRAP_ARGS branch=$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