This script is a part of my larger bmms program. Since bmms uses vorbiscomment, oggenc, and oggdec, I wanted to provide an easy way for my users to get it. So I created this script:
Code:
#!/bin/bash
# Name: installVorbis.sh
# Author: Joshua Bailey (jbsnake (at nospam) usalug.org)
function errorInstall
{
./configure --prefix=/usr &&
cd lib &&
cp Makefile Makefile.bak &&
sed s/-mno-ieee-fp// Makefile.bak > Makefile &&
cd .. &&
make &&
make install
}
function install
{
./configure --prefix=/usr &&
make &&
make install
}
function getVorbisTools
{
wget http://www.vorbis.com/files/1.0.1/unix/libogg-1.1.tar.gz
wget http://www.vorbis.com/files/1.0.1/unix/libvorbis-1.0.1.tar.gz
wget http://www.vorbis.com/files/1.0.1/unix/vorbis-tools-1.0.1.tar.gz
}
function installLibOgg
{
tar zxvf libogg-1.1.tar.gz
cd libogg-1.1
install
cd ~-
}
function installLibVorbis
{
tar zxvf libvorbis-1.0.1.tar.gz
cd libvorbis-1.0.1
install
if [[ $? > 0 ]]
then
errorInstall
fi
cd ~-
}
function installVorbisTools
{
tar zxvf vorbis-tools-1.0.1.tar.gz
cd vorbis-tools-1.0.1
install
cd ~-
}
id | grep "uid=0" > /dev/null
if [[ $? != 0 ]]
then
echo "You must be root to run ${0}!"
exit
fi
which gcc 2> /dev/null | grep "gcc" > /dev/null
if [[ $? > 0 ]]
then
echo "You must have gcc in order to use this function!"
echo "Either install gcc or download the binaries for vorbis"
echo "on your own."
exit
fi
ping -c2 http://www.vorbis.com > /dev/null
if [[ $? != 0 ]]
then
echo "You must be connected to the internet!"
exit
fi
echo "We are now going to download and install vorbis."
echo "Once it is downloaded, it will automatically install."
echo "You might want to go grab a bite to eat or take your"
echo "restroom break now."
read -p "Press enter to begin..."
getVorbisTools
installLibOgg
installLibVorbis
installVorbisTools