#!/bin/bash
# 7000-s3-savage-generic.sh
# match S3 Savage family through Xorg savage driver

XORG_CONF="$1"

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

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

case "$PCI_DEVICE_ID" in
    8a20|8a21|8a22|8a23|8c10|8c11|8c12|8c13|9102|9104|9105|9106|9107|9110|9111|9112|9113|9120|9121|9122|9123|8d01|8d02|8d03|8d04)
        ;;
    *)
        exit 1
        ;;
esac

logger -t retrodebian-xorg-autoconfig "Configuring S3 Savage savage for $PCI_DEVICE_NAME [$PCI_DEVICE_ID]"

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

exit 0