#!/bin/sh
#101112 fixed path include supported_chips
#110827 ati db entry may have dep |+linux_kernel&eq2.6.32|, so insert 'q'.

DEVICEID="$1"
PET_DB_FILE="$2" #exs: Packages-puppy-wary5-official, Packages-puppy-lucid-official, Packages-puppy-5-official
dPATTERN='|'"$DEVICEID"'$'

. /usr/local/video_upgrade/supported_chips #101112

echo -n "" > /tmp/vuw_ati_pkg

KERNELVER="`uname -r`"
#110827 ati db entry may have dep |+linux_kernel&eq2.6.32|, so insert 'q'...
kPATTERN='[kq]'"`echo -n "$KERNELVER" | sed -e 's%\.%\\\.%g'`"
PETS_ATI="`grep '^ati_fglrx\-' /root/.packages/${PET_DB_FILE} | grep -i "${kPATTERN}" | cut -f 8 -d '|'`"


if [ "`echo "$ATICHIPS_10_10" | grep -i "$dPATTERN"`" != "" ];then
 PET="`echo "$PETS_ATI" | grep '^ati_fglrx\-10\.10\-' | tail -n 1`"
 echo -n "$PET" > /tmp/vuw_ati_pkg
 echo "PET=$PET"
 exit
fi
