#/bin/sh

echo "Adam's nx6325 EasyWAY 1.1 configuration script"
echo "1. I will now Install all necessary packages."
sleep 3
apt-get -y update
apt-get -y install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential debhelper html2text dh-make module-assistant mc

echo "2. I will now download Kernel sources and the configuration file."
sleep 3
cd /usr/src/
wget http://www.eu.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.6.tar.bz2

tar xjf linux-2.6.22.6.tar.bz2
ln -s linux-2.6.22.6 linux
cd /usr/src/linux

wget http://www.adamkowalewski.com/easy_way/config.txt
mv /usr/src/linux/config.txt /usr/src/linux/.config


echo "3. I will now compile your kernel."
echo "It will take some time."
echo "So feel free to get yourself a beer or two."
sleep 3

make-kpkg clean
make-kpkg kernel_image kernel_headers

cd /usr/src/

dpkg -i linux-image-2.6.22.6ak1_2.6.22.6ak1-10.00.Custom_i386.deb
dpkg -i linux-headers-2.6.22.6ak1_2.6.22.6ak1-10.00.Custom_i386.deb


echo "4. I will now download the Broadcom firmware."
sleep 3

cd /lib/firmware
wget http://www.adamkowalewski.com/easy_way/bcmfirm.tar.bz2
tar xjf bcmfirm.tar.bz2
rm bcmfirm.tar.bz2
cd /

echo "5. Some extra packages."
sleep 3

apt-get -y install powernowd lm-sensors sensors-applet hddtemp

echo "6. Now some final settings."
sleep 3

echo "k8temp" >> /etc/modules
echo "lm90" >> /etc/modules
echo "i2c-piix4" >> /etc/modules
echo "eeprom" >> /etc/modules
echo "powernow-k8" >> /etc/modules

echo "#/bin/sh" >> /etc/init.d/1-autostart
chmod +x /etc/init.d/1-autostart
echo "/autostart" >> /etc/init.d/1-autostart
echo "#/bin/sh" >> /autostart
echo "echo ----------------------------------" >> /autostart
echo "echo \"-------------My Autostart:\"" >> /autostart
echo "echo ----------------------------------" >> /autostart
echo "powernowd -m 2" >> /autostart
echo "echo ----------------------------------" >> /autostart
echo "echo \"-------------EndOf My Autostart:\"" >> /autostart
echo "echo ----------------------------------" >> /autostart
chmod +x /autostart

echo "Ok, we are done. I will now reboot"
echo "Thank you for using my script."
echo "cya"
echo "adam"
sleep 3

reboot

#--WORKS & tested
