#!/bin/sh
#
# $Header$
#unix shell script to fetch latest svn, make, then run the fresh compilation
#script should work if you followed Readme.Linux and have extracted a T3CH builds XBMC folder to $HOME/Desktop
#userconfig begins
home_folder=$HOME
target_folder=/Desktop/XBMC #where under $HOME the extracted XBMC folder is located
#userconfig ends
#checking if all necessary packages are installed
dpkg -l g++-4.1 gcc-4.1 libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev libsdl-stretch-dev libcdio6 libcdio-dev libfribidi0 libfribidi-dev liblzo1 liblzo-dev libfreetype6 libfreetype6-dev libsqlite3-0 libsqlite3-dev libogg-dev
if [ $? -eq 1 ]
then
echo "$0 : ***ERROR*** You're missing one (or more) of the required packages that are listed in README.Linux"
exit 1
fi
#
clear
echo "---> Doing a SVN Checkout"
cd $home_folder
svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC
clear
echo "---> cleaning old compile ..."
cd XBMC
make clean
clear
echo "---> ... and making a new compile"
make
if [ $? -eq 1 ]
then
echo "$0 : ***ERROR*** Build failed, aborting..."
exit 1
fi
clear
echo "---> Copying file "
cd $home_folder
cp -v XBMC/XboxMediaCenter $home_folder$target_folder
if [ $? -eq 1 ]
then
echo "XBMC is already running from the target folder, press 'k' to Kill XBMC or any other key to abort"
read question
if [ $question eq k ]
then
killall -1 XboxMediaCenter
cp -v XBMC/XboxMediaCenter $home_folder$target_folder
echo "---> XBMC Killed & Replaced"
else
echo "Aborting"
exit 1
fi
fi
clear
echo "---> Running XBMC"
$home_folder$target_folder/XboxMediaCenter
echo "Thanks for testing Linux XBMC!!"