#!/bin/sh

OS_VERSION=`uname -r`
localpath=`pwd`

checkdriver()
{
	if [ `versions | grep -c wac_` -ne 0 ]
	then
		echo Please uninstall old Wacom Driver from Software Manager first
		exit
	fi
	versions | grep "Wacom Tablet" > /tmp/version.txt
	if [ -f /tmp/version.txt ]
	then
	   if [ `grep -c 4.0. /tmp/version.txt` -ne 0 ] | \
		   	[ `grep -c 4.1. /tmp/version.txt` -ne 0 ] | \
			   [ `grep -c 4.2. /tmp/version.txt` -ne 0 ] | \
			   [ `grep -c 4.3. /tmp/version.txt` -ne 0 ] | \
			   [ `grep -c 4.4. /tmp/version.txt` -ne 0 ] | \
			   [ `grep -c 4.5. /tmp/version.txt` -ne 0 ] 
	   then
		   echo Please uninstall old Wacom Driver from Software Manager first
		   rm -f /tmp/version.txt
		   exit
	   fi
	fi
}

case ${OS_VERSION} in

	6.5)
		if [ `id | grep -c root` -eq 0 ]
		then
			echo You must be superuser to run this installer
		else
			checkdriver
			echo 
			cd $localpath/opt
			/sbin/sh INSTALL_LOCAL
			exec swmgr -f $localpath/dist -I WacomTablet
		fi
		;;

	*)
		echo We do not support Irix $OS_VERSION
		;;

esac

