summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Garcia-Dominguez <antonio.garciadominguez@uca.es>2012-04-17 23:21:17 +0200
committerAntonio Garcia-Dominguez <antonio.garciadominguez@uca.es>2012-04-17 23:21:17 +0200
commit15fc7e360f66eef36c287894bbfb467515a489b1 (patch)
treefc052b2d0e2b03e296527fa5d4082c8563855324
parent2c82e23c899a04c1132ecee31bee5433c1803a5e (diff)
Install v4l-utils if required
-rwxr-xr-xprepare-videochat.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/prepare-videochat.sh b/prepare-videochat.sh
index 7b2e49c..3fdd8f4 100755
--- a/prepare-videochat.sh
+++ b/prepare-videochat.sh
@@ -143,12 +143,21 @@ fi
# Use the first "v4l2 loopback" device as the webcam: this should help
# when loading v4l2loopback on a system that already has a regular
# webcam.
-for d in /dev/video*; do
- if v4l2-ctl -d "$d" -D | grep -q "v4l2 loopback"; then
- DEVICE=$d
- break
+if ! can_run v4l2-ctl; then
+ if can_run apt-get; then
+ sudo apt-get install v4l-utils
+ elif can_run pacman; then
+ sudo pacman -S v4l-utils
fi
-done
+fi
+if can_run v4l2-ctl; then
+ for d in /dev/video*; do
+ if v4l2-ctl -d "$d" -D | grep -q "v4l2 loopback"; then
+ DEVICE=$d
+ break
+ fi
+ done
+fi
if [ -z "$DEVICE" ]; then
DEVICE=/dev/video0
warning "Could not find the v4l2loopback device: falling back to $DEVICE"