Build fglrx

#!/bin/bash

# download
#wget --no-check-certificate https://www2.ati.com/drivers/linux/ati-driver-installer-9-1-x86.x86_64.run -P /root/ati
#wget --no-check-certificate https://www2.ati.com/drivers/linux/ati-driver-installer-9.2-x86.x86_64.run -P /root/ati
# --extract
#chmod 777 /root/ati/ati-driver-installer-9-1-x86.x86_64.run

# install envirement
#apt-get install -f -y
apt-get install -y build-essential cdbs fakeroot dh-make debhelper debconf libstdc++5 dkms linux-headers-$(uname -r)
depmod -a

modprobe -r fglrx
rm /lib/modules/2.6.27-11-generic/updates/dkms/fglrx.ko

mkdir /tmp/ati
cd /tmp/ati

#/cdrom/fglrx_old/ati-driver-installer-9.2-x86.x86_64.run --buildpkg Ubuntu/intrepid
./ati-driver-installer-9-5-x86.x86_64.run --buildpkg Ubuntu/jaunty

# -- buildandinstallpkg
modprobe fglrx
aticonfig --initial

cp /tmp/ati/*.deb ~/fglrx/intrepid

cp /lib/modules/$(uname -r)/updates/dkms/fglrx.ko ~/fglrx/intrepid
cp *.deb /root/fglrx/jaunty/

# test 1
apt-get install -f
dpkg -i /home/pako/develop/fglrx/intrepid/*.deb
apt-get install -f
mkdir -p /lib/modules/$(uname -r)/updates/dkms
cp /home/pako/develop/fglrx/intrepid/fglrx.ko /lib/modules/$(uname -r)/updates/dkms/
depmod -a $(ls /lib/modules)

# test 2
#mkdir /root/ati
#wget --no-check-certificate https://www2.ati.com/drivers/linux/ati-driver-installer-9-1-x86.x86_64.run -P /tmp/root
#cd /root/ati
#echo "-------------4----------------"
#chmod 777 /tmp/root/ati-driver-installer-9-1-x86.x86_64.run
#/tmp/root/ati-driver-installer-9-1-x86.x86_64.run --buildandinstallpkg Ubuntu/intrepid