#! /bin/bash
#----------------
# Vars
A="a"
D="d"
B="b"
I="i"
U="u"
H="h"
Q="q"
Y="y"
N="n"
#----------------
#functions
function packcheck {
sudo apt-get install subversion build-essential automake flex bison libpopt-dev libpng12-dev libsdl1.2-dev libopenal-dev libphysfs-dev libvorbis-dev libtheora-dev libglc-dev zip > /dev/null
echo "checked for packages and installed missing ones"
}
function choose {
read choice
if [ $choice = $Y ] ; then
$*
else
echo "aborting!"
exit 0
fi
}
function dircheck {
echo "where would you like me to $* ? (define from root)"
read where
if [ -d $where ] ; then
echo "location allready exists, continue?(Y/N)"
choose echo "ok"
cd $where
else
echo "location does not exit, create it?(Y/N)"
choose mkdir $1
fi
}
function smod {
sudo chmod 755 $1 -R
}
#----------------
# starter
if [ -z $1 ] ; then
#----------------
# root checker!
if [ $(whoami) != 'root' ] ; then
echo "please execute as root"
echo "if sudo doesn't work, move this script to /bin/"
exit 0
else
#----------------
#script
clear
echo "----------------------------------------------------------------------"
echo " __ __ _____ ____ _ ___ ___ "
echo " / / /\ \ \__ _ _ __/ _ / ___ _ __ ___|___ \/ |/ _ \ / _ \ "
echo " \ \/ \/ / _\` | '__\// / / _ \| '_ \ / _ \ __) | | | | | | | | "
echo " \ /\ / (_| | | / //\ (_) | | | | __// __/| | |_| | |_| | "
echo " \/ \/ \__,_|_| /____/\___/|_| |_|\___|_____|_|\___/ \___/ "
echo " installer script, made by munsking "
echo "----------------------------------------------------------------------"
echo ""
echo "What do you want to do?"
echo " [A]ll"
echo " [D]ownload"
echo " [B]uild"
echo " [I]nstall"
echo " [U]ninstall"
echo " [H]elp"
echo " [Q]uit"
read Choice
clear
if [ $Choice = $A ] ; then
dircheck install the whole thing
packcheck
`svn co https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk/ $where`
./autogen.sh
./configure
make
make install
elif [ $Choice = $D ] ; then
dircheck download
`sudo svn co https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk/ $where`
elif [ $Choice = $B ] ; then
dircheck build
./autogen.sh
./configure
make
elif [ $Choice = $I ] ; then
dircheck install
make install
elif [ $Choice = $U ] ; then
dircheck uninstall
echo "are you sure you want to uninstall(Y/N)?"
choose make uninstall
elif [ $Choice = $H ] ; then
echo "----------------------------------------------------------------------"
echo " __ __ _____ ____ _ ___ ___ "
echo " / / /\ \ \__ _ _ __/ _ / ___ _ __ ___|___ \/ |/ _ \ / _ \ "
echo " \ \/ \/ / _\` | '__\// / / _ \| '_ \ / _ \ __) | | | | | | | | "
echo " \ /\ / (_| | | / //\ (_) | | | | __// __/| | |_| | |_| | "
echo " \/ \/ \__,_|_| /____/\___/|_| |_|\___|_____|_|\___/ \___/ "
echo " installer script, made by munsking "
echo "----------------------------------------------------------------------"
echo ""
echo " HELP:"
echo " why would you need help? just follow the instructions :P"
echo " you only need to type the brackated letter in lower case"
echo " so to download, just type \"a\" and it will start the download"
echo " if asked for (Y/N) type \"y\" or \"n\""
echo " if asked for a location, just type it from root. so in my case:"
echo " \"/home/munsking/\""
echo ""
echo " credits:"
echo " Munsking for creating this script (munsking@gmail.com)"
echo " Pumpkin Studios and Eidos Interactive for making the game"
echo " the Warzone2100 Project for keeping the game alive and for linux(wz2100.net)"
echo ""
exit 0
elif [ $Choice = $Q ] ; then
echo "bye bye"
exit 0
else
echo "please enter the bracketed letter in lower case"
echo "try again? (Y/N)"
choose sudo $0
exit 0
fi
echo "done"
smod $where
fi
else
echo "no need for syntaxes, just execute :)"
exit 0
fi