#!/bin/sh
echo "************************************"
echo "*** Ubuntu 8.04 LTS RiceeeyTweak ***"
echo "***         version 0.5          ***"
echo "***       eee.ricey.co.uk        ***"
echo "************************************"
echo "thanks to http://www.x2on.de"
echo "thanks to http://ubuntu-eee.tuxfamily.org/"
echo "thanks to http://code.google.com/p/eee-osd/"
echo "thanks to http://wiki.eeeuser.com"
echo "thanks to Bombela"
echo "************************************"
echo "** Gnome settings"
echo "* Setting font sizes"
gconftool-2 --set /apps/nautilus/preferences/desktop_font --type string "Sans 8"
gconftool-2 --set /desktop/gnome/interface/document_font_name --type string "Sans 8"
gconftool-2 --set /desktop/gnome/interface/font_name --type string "Sans 8"
gconftool-2 --set /apps/metacity/general/titlebar_font --type string "Sans Bold 8"
gconftool-2 --set /desktop/gnome/interface/monospace_font_name --type string "Monospace 8"
echo "* Smaller toolbars icons only"
gconftool-2 --set /desktop/gnome/interface/toolbar_style --type string "icons"
echo "* Disabling UI sounds"
gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool 0
echo "* Fixing mute key"
gconftool-2 --set /desktop/gnome/sound/default_mixer_tracks --type list --list-type string "[PCM]"
echo "* Fullscreen with <Alt>-F11"
gconftool-2 --set /apps/metacity/window_keybindings/toggle_fullscreen --type string "<Alt>F11"
echo "* Setting suspend when closing lid, blank screen"
gconftool-2 --set /apps/gnome-power-manager/actions/sleep_type_battery --type string "suspend"
gconftool-2 --set /apps/gnome-power-manager/actions/sleep_type_ac --type string "suspend"
gconftool-2 --set /apps/gnome-power-manager/buttons/lid_battery --type string "suspend"
gconftool-2 --set /apps/gnome-power-manager/buttons/lid_ac --type string "blank"
gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_computer_ac --type int 0
gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_computer_battery --type int 300
gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_display_ac --type int 300
gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_display_battery --type int 60
echo "* Don't display battery warning"
gconftool-2 --set /apps/gnome-power-manager/notify/low_capacity --type bool 0
echo "* Unconstraining windows to the top of the screen"
gconftool-2 --type bool --set /apps/compiz/plugins/move/allscreens/options/constrain_y 0
echo "Gnome settings done."
echo "** Installing ACPI modules"
sudo apt-get update
sudo apt-get install -y -f build-essential module-assistant eeepc-acpi-source  --force-yes
sudo m-a a-i eeepc-acpi
echo "Done"
echo "** Building Eee Overclocking Driver"
wget "http://eeepc-linux.googlecode.com/files/eeepc-linux-0.2.tar.gz"
tar xvzf eeepc-linux-0.2.tar.gz
cd eeepc-linux/module
make
sudo cp eee.ko /lib/modules/$(uname -r)/kernel/
cd ../../
echo "Done"
echo "** Installing Modules and Driver"
echo "*Unblacklisting i2c-i801 module"
sed 's/blacklist i2c_i801/#blacklist i2c_i801/' </etc/modprobe.d/blacklist >blacklist.tmp
sudo mv blacklist.tmp /etc/modprobe.d/blacklist
sudo chown root:root /etc/modprobe.d/blacklist
echo "Done"
echo "*Updating /etc/modules"
sudo cp /etc/modules modules.tmp
sudo chmod 777 modules.tmp
echo "eeepc-acpi" >> modules.tmp
echo "i2c-i801" >> modules.tmp
echo "eee" >> modules.tmp
sudo chmod 644 modules.tmp
sudo mv modules.tmp /etc/modules
sudo chown root:root /etc/modules
echo "Done"
echo "**Installing Overclock Utilities"
wget "http://eee.ricey.co.uk/files/eee/oc.sh"
wget "http://eee.ricey.co.uk/files/eee/ocn.py"
wget "http://eee.ricey.co.uk/files/eee/Overclock.desktop"
sudo mv oc.sh /usr/bin
sudo chown root:root /usr/bin/oc.sh
sudo chmod +x /usr/bin/oc.sh
sudo mv ocn.py /usr/bin
sudo chown root:root /usr/bin/ocn.py
sudo chmod +x /usr/bin/ocn.py
mv Overclock.desktop ~/Desktop
echo "Done"
echo "** Installing OSD"
wget http://eee-osd.googlecode.com/files/eee-osd_2.1-0eeeXubuntu1_i386.deb
sudo dpkg -i eee-osd_2.1-0eeeXubuntu1_i386.deb
echo "Done"
echo "** Configuring Sound"
echo "options snd-hda-intel model=3stack-dig" > snd-hda-intel.tmp
sudo mv snd-hda-intel.tmp /etc/modprobe.d/snd-hda-intel
sudo chown root:root /etc/modprobe.d/snd-hda-intel
echo "Done"
echo "** Fixing Shutdown Problem"
sudo sed 's/#! \/bin\/sh/#! \/bin\/sh\n\n##Riceeey Eee shutdown fix\n\nrmmod snd-hda-intel\n/' </etc/init.d/halt >halt.tmp
sudo mv halt.tmp /etc/init.d/halt
sudo chown root:root /etc/init.d/halt
sudo chmod +x /etc/init.d/halt
echo "Done"
echo "** Adjusting Disk atime"
sudo sed 's/relatime/noatime/' </etc/fstab >fstab.tmp
sudo mv fstab.tmp /etc/fstab
sudo chown root:root /etc/fstab
echo "Done"
echo "** Installing WLAN"
wget 'http://snapshots.madwifi.org/madwifi-hal-0.10.5.6/madwifi-hal-0.10.5.6-r3835-20080801.tar.gz'
tar zxf madwifi-hal-0.10.5.6-r3835-20080801.tar.gz
cd madwifi-hal-0.10.5.6-r3835-20080801
make clean
make
sudo make install
cd ../
echo "Done"
echo "All relevant drivers are now installed - hopefully!"
echo "If you have any troubles please refer back to eee.ricey.co.uk"
echo "Please reboot now"
