#!/bin/bash
TRUE=1
FALSE=0
echo Script Designed to Install a newer version of the alsa module and drivers
echo For Ubuntu. Taken from information from the ALSA Ubuntu wiki page.
echo -----------------------------------------------------------------------------
echo ------------------- THIS SCRIPT IS VERY UNTESTED ----------------------------
echo ------------------- You may need to fix things.. ----------------------------
echo -----------------------------------------------------------------------------
echo THE INSTALL LINES ARE COMMENTED OUT. Just to be safe.
echo -----------------------------------------------------------------------------
# In an attmpt to make the script a little easier if ran more then once
# Settings are Here.
#
DOWNLOADALSA=$FALSE
#DOWNLOADALSA=$TRUE
UPDATESYSTEM=$FALSE
#UPDATESYSTEM=$TRUE
GRABPACKAGES=$FALSE
#GRABPACKAGES=$TRUE
# Do a System Update and Upgrade to be sure the system is up to date first.
# if a KERNEL was updated - this can mess things up.
# since the alsa module wont get compiled for the new kernel. But the currently
# running one. If that happens - the user will need to reboot and
# rerun this script to recompile the modules for the proper kernel
if [ "$UPDATESYSTEM" -eq "$TRUE" ]
then
echo Updateing the System to get things in a sane state.
sudo apt-get update
sudo apt-get upgrade
echo If the Kernel was updated. I suggest rebooting and using the new kernel. and
echo reruning this script
fi
if [ "$GRABPACKAGES" -eq "$TRUE" ]
then
echo -----------------------------------------------------------------------------
echo Installing the Needed parts required to Compile the Modules
echo -----------------------------------------------------------------------------
echo Installing the unp program also.
echo Because it makes unarchiving things SO much easier
echo and its so tiny and handy.
sudo apt-get install unp
sudo apt-get install build-essential ncurses-dev gettext
sudo apt-get install linux-headers-`uname -r`
sudo apt-get install libncurses5-dev
fi
echo Starting the Main Part of the Program - Grabbing the ALSA source and putting it
echo In the Proper place to compile it - /usr/src/alsa
echo -----------------------------------------------------------------------------
# really should test to make sure the dir is not already there.
sudo mkdir /usr/src/alsa
cd /usr/src/alsa/
if [ "$DOWNLOADALSA" -eq "$TRUE" ]
then
echo ----------------------------------------------------------------------------
echo Getting the Latest versions of the files at the time this script was written
echo Dec 18 2007
echo need to make an easier way to change these Filenames, but then i also have to
echo fix the dir names used later.
echo ----------------------------------------------------------------------------
sudo wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.15rc3.tar.bz2
sudo wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.15rc3.tar.bz2
sudo wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.15rc1.tar.bz2
# See what i mean... Small simple command that uncompresses all the archives
sudo unp *.bz2
fi
echo -----------------------------------------------------------------------------
echo ----- NOW THE SOURCE IS READY TO COMPILE ----------
echo -----------------------------------------------------------------------------
## Straight forward way to compile the stuff. note that the
## sudo make install lines are COMMENTED OUT. Just to allow for safer testing
## I need to find a cleaner way to have the file names, and dirs changeable
cd /usr/src/alsa/alsa-driver-1.0.15rc3
sudo ./configure --with-cards=hda-intel
sudo make
## Commented out to make testing of the script easier.
#sudo make install
echo -----------------------------------------------------------------------------
echo ------------- Alsa-Driver compile Done ----
echo -----------------------------------------------------------------------------
cd /usr/src/alsa-lib-1.0.15rc3
sudo ./configure
sudo make
# Commented Out
#sudo make install
echo -----------------------------------------------------------------------------
echo ------------ Alsa-Lib Compile Done ----
echo -----------------------------------------------------------------------------
cd /usr/src/alsa/alsa-utils-1.0.15rc1
sudo ./configure
sudo make
#commented out
#sudo make install
echo -----------------------------------------------------------------------------
echo ------------ Alsa-utils Compile Done ----
echo -----------------------------------------------------------------------------
echo -_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_-
echo Ta Da - Hopefull it all worked. Reboot to find out.
echo If not - i suggest a reread of the Ubuntu alsa wiki page.
echo -_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_--_-_-_-_