-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·37 lines (32 loc) · 1.13 KB
/
run.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
#!/bin/bash
# Habilitar acceso gráfico local
xhost +local:docker 1> /dev/null
# Construir la imagen de Docker
docker build -f build/uros.Dockerfile -t microrosimage .
# Verificar si la opción --flash fue proporcionada
if [[ "$1" == "--flash" ]]; then
# Verificar si se ha especificado el dispositivo /dev/ttyUSB
if [[ -z "$2" ]]; then
echo "Error: Debes especificar el dispositivo /dev/ttyUSB a utilizar."
echo "Uso: $0 --flash /dev/ttyUSBx"
exit 1
fi
# Ejecutar el contenedor con el dispositivo especificado
docker run -it \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/root/.Xauthority \
--network host \
--mount src="./app",target="/home/robot/app",type=bind \
--device=$2:$2 \
microrosimage:latest
else
# Ejecutar el contenedor sin el dispositivo
docker run -it \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/root/.Xauthority \
--network host \
--mount src="./app",target="/home/robot/app",type=bind \
microrosimage:latest
fi