#!/bin/bash
# Instal·la el driver pel wi-Fi del Acer Aspire One
# Escrit per Paco Rivière http://pacoriviere.cat - Agost 2008 - Per a Ubuntu Hardy 8.04 - Llicència GNU\GPL
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

function ajuda {
echo "Ús: bash $0"
echo
}

function wifi () {
# Prepara el wifi
# https://wiki.ubuntu.com/CatalanTeam/Tutorials/AspireOne
cd $HOME/source/
tar xfz madwifi-hal-0.10.5.6-r3835-20080801.tar.gz
cd madwifi-hal-0.10.5.6-r3835-20080801 
make
sudo make install
sudo modprobe ath_pci
}

function recompila () {
# Recomplia el wifi
# https://wiki.ubuntu.com/CatalanTeam/Tutorials/AspireOne
cd $HOME/source/
cd madwifi-hal-0.10.5.6-r3835-20080801 
make clean
make
sudo make install
}

Echo "Cal que reinicieu per que els canvis sigui"

# Menu i bucle principal
while true ;
do
	echo "Trieu una opció"
	echo "0 - Surt"
	echo "1 - Prepara Wifi (Trieu-ho el primer cop per baixar els drivers)"
	echo "2 - Recompila Wifi (Trieu-ho després d'instal·lar un nou nucli)"
	echo "3 - Ajuda"
	read Opcio
	case "$Opcio" in
	  0 ) exit 1 ;;
	  1 ) wifi ;;
	  2 ) recompila ;;
	  3 ) ajuda ;;
	  * ) echo "Opció incorrecta" ;;
	esac
done
