Here is the script :
#!/bin/bash
# hedgewars_on_lenny.sh
# Script to install hedgewars on a debian lenny
# It installs the latest version avaiable
# For dependencies install, it requires sudo.
# Bug reports and suggestions :
check_dep()
{
PACKAGES="mercurial cmake qt4-qmake libqt4-dev libsdl1.2-dev libsdl-net1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev liblua5.1-dev fpc "
echo -e "These packages have to be installed, let's check : \n"
echo -e $PACKAGES \n
for i in $PACKAGES; do
# test if package is installed
if [ "$(dpkg-query -s $i | grep Status |awk '{print $4}' )" = "installed" ]; then
echo -e "Package $i seems to be installed \n"
else
echo -e "We need $i \n"
echo -e "Installing $i \n"
echo -e "apt-get install $i \n"
sudo apt-get install $i
fi
done
}
check_dep_wserver()
{
PACKAGES="mercurial cmake qt4-qmake libqt4-dev libsdl1.2-dev libsdl-net1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev liblua5.1-dev fpc ghc6 libghc6-dataenc-dev libghc6-hslogger-dev libghc6-utf8-string-dev"
echo -e "These packages have to be installed, let's check : \n"
echo -e $PACKAGES \n
for i in $PACKAGES; do
# test if package is installed
if [ "$(dpkg-query -s $i | grep Status |awk '{print $4}' )" = "installed" ]; then
echo -e "Package $i seems to be installed \n"
else
echo -e "We need $i \n"
echo -e "Installing $i \n"
echo -e "apt-get install $i \n"
sudo apt-get install $i
fi
done
}
install_()
{
if [ "$1" != "-i" ] || [ "$1" != "-s" ]; then
echo "usage : "
echo " hedgewars_on_lenny.sh -i : install"
echo " hedgewars_on_lenny.sh -s : install with server"
fi
case $1 in
"-i" )
check_dep
echo "Let's download the source code :"
# wget http://fireforge.net/frs/download.php/541/hedgewars-src-0.9.13.tar.bz2
# tar -xvjz hedgewars*.tar.bz2
hg clone https://hedgewars.googlecode.com/hg/ hedgewars
if [ -d hedgewars ]; then
cd hedgewars
echo -e "Starting to compile \n"
cmake .
make
sudo make install
else
echo -e "I can't find hedgewars directory \n"
exit 666
fi
;;
"-s" )
check_dep_wserver
echo "Let's download the source code :"
hg clone https://hedgewars.googlecode.com/hg/ hedgewars
if [ -d hedgewars ]; then
cd hedgewars
echo -e "Starting to compile with server \n"
cmake -DWITH_SERVER=1 .
make
sudo make install
else
echo -e "I can't find hedgewars directory \n"
exit 666
fi
;;
esac
}
echo "Welcome in the compiling hedgewars script"
install_ $1
exit 0