-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsr-bootstrap-ros
executable file
·89 lines (73 loc) · 2.08 KB
/
sr-bootstrap-ros
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
#!/bin/bash
#
# Boot strap a machine with ROS.
# It is safe to run this script multiple times.
#
set -e # Stop on errors
#set -x # echo commands
export ros_release='hydro'
apt_opt="-q --yes"
# Options
usage() {
echo Usage: $0 "[-rRELEASE]"
echo
echo ' -r ROS version to install. Default: hydro'
echo
exit 0
}
while getopts "hr:" opt; do
case $opt in
'?'|h|:|\?)
usage
;;
r)
ros_release=$OPTARG
;;
esac
done
shift $((OPTIND-1))
# Are we root?
if [ "$(id -u)" != "0" ]; then
echo "Not root!"
exit 10
fi
#
# Setup apt sources etc for installing ros
# http://wiki.ros.org/hydro/Installation/Ubuntu
# Set the "seen" flag for debconf questions that --yes fails for.
# cluster is still non-interactive, see above.
# Except you can't set the "seen" flag for something that isn't installed
#cat <<EOF | debconf-set-selections
##gdm shared/default-x-display-manager seen true
#hddtemp hddtemp/daemon seen true
#EOF
echo Activating restricted, universe, multiverse
release=$(lsb_release -sc)
bak_file=""
sed -i".bak-$(date +'%Y%m%d-%H%M%S')" "s/^#\(deb.*$release\(-updates\)\? \(restricted\|universe\|multiverse\)\)/\1/" /etc/apt/sources.list
# Add ros repo
echo "deb http://packages.ros.org/ros/ubuntu $release main" > /etc/apt/sources.list.d/ros-latest.list
echo Adding the ros key
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
echo Updating apt
apt-get update $apt_opt
apt-get dist-upgrade $apt_opt
echo Installing packages
# git - to setup user, grab shadow code
# python-yaml - handy for the build tools
#apt-get install $apt_opt git qgit python-yaml ntp acpid
apt-get install $apt_opt python-wstool
#apt-get install $apt_opt screen tmux terminator
echo Installing desktop system
# Used when starting from a vagrant base image
apt-get install $apt_opt ubuntu-desktop
#
# Bootstrap ROS
#
echo Installing ROS $version
apt-get install $apt_opt ros-$ros_release-desktop-full
source /opt/ros/$ros_release/setup.bash
if [ ! -f "/etc/ros/rosdep/sources.list.d/20-default.list" ]; then
rosdep init
fi
echo DONE