#!/bin/sh

#set -x
#PATH=.:$PATH

VIDCARD=$(xviddetect -q)
TESTOPT=$1

if [ $VIDCARD ]; then 
  if [ $VIDCARD == "unknown" ]; then
    echo "Sorry, I can't detect your card"
    exit 0
  else
    echo "The $VIDCARD driver should work on your card."
    if [ -z $TESTOPT ]; then 
      echo "xserver-$VIDCARD install" | dpkg --set-selections
      echo "xserver-$VIDCARD is scheduled for installation"
    else
      echo "Test mode, skipping scheduling of xserver-$VIDCARD for installation"
    fi
  fi
fi

