From 433e1ffaa6eda50b38272b6d62f098a0e6f24435 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Mar 2022 10:27:11 -0400 Subject: [PATCH] added test to ensure video device exists --- build/linux/start.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/linux/start.sh b/build/linux/start.sh index eade46c..94b5fcb 100755 --- a/build/linux/start.sh +++ b/build/linux/start.sh @@ -1,16 +1,16 @@ #!/bin/bash DATA_FOLDER=$(pwd)/data/ - +declare CAM0 CAM1 CAM2 CAM3 printf "\n" while getopts 'cd:h' opt; do case "$opt" in c) printf "Starting with camera devices\n" - CAMERA0=--device=/dev/video0:/dev/video0 - CAMERA1=--device=/dev/video1:/dev/video1 - CAMERA2=--device=/dev/video2:/dev/video2 - CAMERA3=--device=/dev/video3:/dev/video3 + test -f /dev/video0 && CAM0=--device=/dev/video0:/dev/video0 + test -f /dev/video1 && CAM1=--device=/dev/video1:/dev/video1 + test -f /dev/video2 && CAM2=--device=/dev/video2:/dev/video2 + test -f /dev/video3 && CAM3=--device=/dev/video3:/dev/video3 ;; d) DATA_FOLDER="$OPTARG" @@ -29,4 +29,4 @@ printf "\n" # Warning xhost + is overly permissive and will reduce system security. Edit as desired docker build . -t deepfacelive xhost + -docker run --ipc host --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $DATA_FOLDER:/data/ $CAMERA0 $CAMERA1 $CAMERA2 $CAMERA3 --rm -it deepfacelive +docker run --ipc host --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $DATA_FOLDER:/data/ $CAM0 $CAM1 $CAM2 $CAM3 --rm -it deepfacelive