-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bash
More file actions
executable file
·37 lines (31 loc) · 1.01 KB
/
install.bash
File metadata and controls
executable file
·37 lines (31 loc) · 1.01 KB
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
#!/usr/bin/env bash
valid_distros=("indigo" "jade" "kinetic" "lunar" "melodic" "noetic" "foxy" "galactic" "humble" "iron" "jazzy" "kilted" "rolling")
if [ -z "$1" ]; then
echo "Usage: $0 <distro>"
echo "Valid options: ${valid_distros[*]}"
exit 1
fi
distro="$1"
ros_path="/opt/ros/$distro"
if [[ ! " ${valid_distros[*]} " =~ " ${distro} " ]]; then
echo "Error: '${distro}' is not a supported ROS distribution."
echo "Valid options are: ${valid_distros[*]}"
exit 1
fi
if [ -d "$ros_path" ]; then
echo "ROS distribution '$distro' is already installed at $ros_path."
exit 0
else
echo "Creating directory $ros_path..."
sudo mkdir -p "$ros_path" || { echo "Failed to create $ros_path"; exit 1; }
sudo cp setup.bash /opt/ros/setup.bash
sudo cp $distro/setup.bash $ros_path/setup.bash
echo "Setup files copied successfully."
IMAGE=ros-$distro
if [[ "$distro" == "foxy" || "$distro" == "galactic" ]]; then
TAG="${distro}-desktop"
else
TAG="${distro}-desktop-full"
fi
docker pull osrf/ros:$TAG
fi