#!/bin/bash
# A small bash script for installing CrunchEee 8.10.02
# Run as root (sudo ./cruncheee-installer-8.10.02.sh)
#----------------------------------------------------------

#Add CrunchBang Repository
#=========================
wget http://crunchbang.net/packages-8.10.xx/crunchbang.list -O /etc/apt/sources.list.d/crunchbang.list
wget -q http://crunchbang.net/crunchbang.key -O- | apt-key add - && apt-get update

#Add Medibuntu Repository
#========================
wget http://www.medibuntu.org/sources.list.d/intrepid.list -O /etc/apt/sources.list.d/medibuntu.list
apt-get update && apt-get install medibuntu-keyring && apt-get update

#Add Array.org Repository
#========================
wget http://www.array.org/ubuntu/array-intrepid.list
mv -v array-intrepid.list /etc/apt/sources.list.d/
wget http://www.array.org/ubuntu/array-apt-key.asc
apt-key add array-apt-key.asc
apt-get update

#Install main meta-package
#=========================
apt-get install -y --install-recommends cruncheee-desktop

#Perform a reinstall to ensure all data/settings stick
#===========================================================
apt-get install --reinstall cruncheee-desktop

#Copy new BASH profile to user account
#=====================================
cp -f /etc/skel/.profile ~/.profile
chown $SUDO_USER:$SUDO_USER ~/.profile

#Remove non Eee Kernel
#=====================
echo ""
echo "*****"
echo "Removing non Eee PC Kernel"
echo "*****"
apt-get remove linux-generic linux-image-generic linux-restricted-modules-generic
apt-get remove linux-.*-generic
apt-get autoremove

#Remove all downloaded packages
#==============================
apt-get clean

#Start vim and modify grub boot list
#===================================
echo ""
echo "*****"
echo "Starting vim, please check your GRUB menu and modify if needed..."
echo "*****"
sleep 10s
vim /boot/grub/menu.lst
echo ""

#Exit with message
#=================
echo "Installation complete. Thank you for installing CrunchBang Linux."
echo "You might want to consider rebooting your system."
echo ""
echo "Issue the following command to reboot:"
echo ""
echo "    \$ sudo reboot now"
echo ""

exit 0
