#!/bin/bash
. ./lib

if ( confirm "MadCatz Mad R.A.T.5 patch for xorg. This correct the stop working mouse bug after start X session.\n\nCreate /usr/share/X11/xorg.conf.d/50-madcatzrat5.conf ?" ) then
cat << EOF > /usr/share/X11/xorg.conf.d/50-madcatzrat5.conf
Section "InputClass"
  Identifier "Madcatz Mad Catz R.A.T.5"
  MatchProduct "Madcatz Mad Catz R.A.T.5 Mouse"
  MatchDevicePath "/dev/input/event*"
  Option "Buttons" "21"
  Option "ButtonMapping" "1 2 3 4 5 0 0 11 10 7 6 8 0 0 0 0"
  Option "ZAxisMapping" "4 5 11 10"
  Option "AutoReleaseButtons" "13 14 15"
EndSection
EOF
fi

exit 0