#!/bin/sh
#
# This script is poorly written, but for now it does the job...
#

# Petite astuce pour relancer le serveur automatiquement s'il plante
if [ $# -gt 0 ] ; then
  while true ; do
    $*
    sleep 60
  done
fi

# Ajustez ces variables comme il faut
installdir="/opt/openarena"
#arch="i386"
arch="x86_64"

homepath="/home/admin/oaconfig/server1" # CHANGER pour chaque serveur
name="instagib" # expl: instagib, myserver1, whatever...

configfilename="server.cfg"
mod_name="baseoa"
#mod_name="missionpack"


# Normalement, pas besoin d'éditer ci-dessous...

# On ajoute le mod choisi en paramètre
mod_parameter=""
if [ $mod_name != "baseoa" ]
  then mod_parameter="+set fs_game $mod_name"
fi

# Autres paramètres facultatifs
#other_params="+set com_hunkMegs 96"

# On lance !
echo Lancement du serveur: $name.

screen -A -m -d -S $name $PWD/`basename $0` $installdir/oa_ded.$arch +set fs_basepath $installdir +set fs_homepath $homepath +set dedicated 2 +exec $configfilename $mod_parameter $other_params
