#!/bin/bash
if [[ $UID != 0 ]]; then
	echo "You must run this script as root."
	exit 1
fi

SRC="http://sunet.dl.sourceforge.net/project/wesnoth/wesnoth-1.6/wesnoth-1.6.5/wesnoth-1.6.5.tar.bz2"
REF="http://sourceforge.net/projects/wesnoth/files/wesnoth/wesnoth-1.6.5.tar.bz2/download"
DST=/usr/src/

pushd $DST
curl --referer "$REF" "$SRC" | tar xfj -
cd wesnoth-1.6.5
apt-get build-dep wesnoth
./configure --datadir=/usr/share/games
make
make install
make clean
popd

echo "All done! Type 'wesnoth' to fire up the game!"
