#!/bin/bash

DD="/usr/sbin/dmidecode"

if [ ! -x "$DD" ]
then
        exit 0
fi

CB_MODEL="$($DD -s system-product-name | awk '{print tolower($1)}')"

if [ -z "$CB_MODEL" ]
then
        exit 0
fi

# Test for a config file in /usr/share/X11/xorg.conf.d
FILE="`find /usr/share/X11/xorg.conf.d/ -name *-touchpad-cmt-$CB_MODEL.conf | head -1`"
if [ "$FILE" -a -r "$FILE" ]; then
	exit 0
fi

# Install model specific config
FILE="`find /usr/share/xf86-input-cmt -name *-touchpad-cmt-$CB_MODEL.conf | head -1`"
if [ "$FILE" -a -r "$FILE" ]; then
        cp -f "$FILE" /usr/share/X11/xorg.conf.d/
fi
