#!/bin/bash
# 4100-s3-virge.sh
# match S3 ViRGE family

XORG_CONF="$1"

[ -n "$XORG_CONF" ] || exit 2
[ -f "$XORG_CONF" ] || exit 2

[ "$PCI_VENDOR_ID" = "5333" ] || exit 1

case "$PCI_DEVICE_ID" in
    5631|883d|8a01)
        ;;
    *)
        exit 1
        ;;
esac

logger -t retrodebian-xorg-autoconfig "Configuring S3 ViRGE s3virge for $PCI_DEVICE_NAME [$PCI_DEVICE_ID]"

sed -i \
    -e "s|{DeviceDriver}|s3virge|g" \
    "$XORG_CONF" || exit 2

exit 0