mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[docker] pass symlinked devices if docker version >= 1.12
Docker should support relative symlinks for devices from version 1.12 on...
This commit is contained in:
+9
-2
@@ -82,8 +82,15 @@ fi
|
||||
# try to detect which USB devices to pass to the container automatically
|
||||
# set DISABLE_USB=1 to turn it off
|
||||
if [ -z "$DISABLE_USB" ]; then
|
||||
# find on OSX doesn't have the -printf option... so use exec echo instead
|
||||
USB_OPTS=$(find /dev -maxdepth 1 \( -name "ttyACM?" -or -name "ttyUSB?" \) -exec echo -n "--device={} " \;)
|
||||
# get major/minor docker version without the dot
|
||||
DOCKER_VERSION=$(docker version | grep -m 1 Version: | awk '{print $2}' | cut -f1,2 -d. | tr -d .)
|
||||
# docker should support relative symlinks for --device options since 1.12
|
||||
if [ "$DOCKER_VERSION" -ge 112 ]; then
|
||||
# find on OSX doesn't have the -printf option... so use exec echo instead
|
||||
USB_OPTS=$(find /dev -maxdepth 2 \( -name "ttyACM?" -or -name "ttyUSB?" -or -name "bmp-*" -or -path /dev/paparazzi/* \) -exec echo -n "--device={} " \; 2> /dev/null)
|
||||
else
|
||||
USB_OPTS=$(find /dev -maxdepth 1 \( -name "ttyACM?" -or -name "ttyUSB?" \) -exec echo -n "--device={} " \; 2> /dev/null)
|
||||
fi
|
||||
if [ -n "$USB_OPTS" ]; then
|
||||
echo Passing auto-detected USB devices: $USB_OPTS
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user