-
Notifications
You must be signed in to change notification settings - Fork 9
/
bootstrap.sh
executable file
·77 lines (65 loc) · 2.23 KB
/
bootstrap.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
#! /bin/sh
CONF_URL=${CONF_URL:=https://github.com/uzh-rpg/eds-buildconf.git}
RUBY=ruby
AUTOPROJ_BOOTSTRAP_URL=http://rock-robotics.org/master/autoproj_bootstrap
BOOTSTRAP_ARGS=
if test -n "$1" && test "$1" != "dev" && test "$1" != "localdev"; then
RUBY=$1
shift 1
RUBY_USER_SELECTED=1
fi
set -e
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
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
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: http) "
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
$RUBY autoproj_bootstrap $@ git $GET_REPO push_to=$PUSH_TO $BOOTSTRAP_ARGS
if test "x$@" != "xlocaldev"; then
$SHELL -c '. $PWD/env.sh; autoproj update; autoproj osdeps; autoproj build'
fi