File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
2424cd " $SCRIPT_DIR "
2525
2626./setup_docker_modules_link.sh $FORCE_FLAG
27- ./setup_docker_volume.sh
27+ ./setup_docker_volume.sh $FORCE_FLAG
2828./setup_isaac_link.sh
2929
3030echo " Post Install Done."
Original file line number Diff line number Diff line change 11#! /bin/bash -e
22
3+ # Parse command line arguments
4+ FORCE_REMOVE=false
5+ while [[ $# -gt 0 ]]; do
6+ case $1 in
7+ -f|--force)
8+ FORCE_REMOVE=true
9+ shift
10+ ;;
11+ * )
12+ echo " Unknown option: $1 "
13+ echo " Usage: $0 [-f|--force]"
14+ echo " -f, --force Force removal of existing volumes"
15+ exit 1
16+ ;;
17+ esac
18+ done
19+
320# Get the directory of this script.
421# Reference: https://stackoverflow.com/q/59895
522SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd) "
623
7- # Create docker volume
8- docker volume create ros2-gazebo-cache > /dev/null
9- docker volume create ros2-isaac-sim-cache > /dev/null
10- docker volume create ros2-isaac-ros-assets > /dev/null
24+ volumes=(ros2-gazebo-cache ros2-isaac-sim-cache ros2-isaac-ros-assets)
25+
26+ # Check for existing volumes
27+ for v in " ${volumes[@]} " ; do
28+ if docker volume inspect " $v " > /dev/null 2>&1 ; then
29+ if [ " $FORCE_REMOVE " = true ]; then
30+ docker volume rm " $v " > /dev/null
31+ else
32+ echo " Error: Docker volume '$v ' already exists."
33+ echo " Run with -f to remove existing volumes and continue."
34+ exit 1
35+ fi
36+ fi
37+ done
38+
39+ # Create docker volumes
40+ for v in " ${volumes[@]} " ; do
41+ docker volume create " $v " > /dev/null
42+ done
1143
1244echo " Set up docker volume done."
You can’t perform that action at this time.
0 commit comments