Commit e6d213c4 authored by Simon McVittie's avatar Simon McVittie

Import Upstream version 7.66+dfsg

parent 56ebfdf6
This diff is collapsed.
This diff is collapsed.
# Process this file with automake to produce Makefile.in
#
# Copyright (C) 2010 COR Entertainment, LLC.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
SUBDIRS = source
ACLOCAL_AMFLAGS = -I m4
# Alien Arena documents to be installed in $docdir
if INSTALL_DOCS
dist_doc_DATA = \
docs/license.txt \
docs/README.txt \
README
endif
# Alien Arena icon
dist_icon_DATA = alienarena.png
# FUSE game server browser and Server management scripts
# COPYING and INSTALL are GNU/FSF-supplied documents.
EXTRA_DIST = \
Tools/fuse.tar.gz \
Tools/LinuxScripts \
COPYING \
INSTALL
# remove svn directories from distribution staging area after creating
# distribution in staging area and before running archiver
# but, it is probably a better idea to export the repository to the
# staging area since export does not include the .svn parts
#
# copy noinst DATA to the distribution directory. while partitioning the
# data files into subdirectory groups solves the problem with exceeding
# command length limits for installation, it does not help with tarball
# creation.
#
dist-hook:
rm -rf `find $(distdir) -name .svn`
$(foreach GAMEDIR, $(sort $(dir $(gamedata_files))),$(shell mkdir -p $(distdir)/$(GAMEDIR) ))
$(foreach GAMEFILE, $(gamedata_files), $(shell cp -p $(srcdir)/$(GAMEFILE) $(distdir)/$(GAMEFILE)))
#
# Alternate Install
# This non-standard target is used for traditional single directory,
# in-place install. Good for map makers, frequent SVN updates.
# Also, maybe the preferable installation for Game Server Providers doing
# dedicated server only builds
#
# Use:
# ./configure --enable-alternate-install && make && make install-alternate
#
# Note: this does not support program name translation and other autoconf
# features.
#
install-alternate:
if ALTERNATE_INSTALL
if BUILD_CLIENT
cp $(top_builddir)/source/alienarena@EXEEXT@ $(srcdir)/alienarena@EXEEXT@
endif
if BUILD_UNIX
cp $(top_builddir)/source/alienarena-ded $(srcdir)/alienarena-ded
endif
else
@echo "make install-alternate requires configuring with --enable-alternate-install"
endif
#
# install/uninstall added rules for alternate-install to prevent "undefined" behaviour.
#
install-data-local:
if ALTERNATE_INSTALL
@echo "Alternate install: Use "make install-alternate"!!!
exit 1
endif
uninstall-local:
if ALTERNATE_INSTALL
@echo "Alternate install. Manual uninstall required!!!"
exit 1
endif
include game_data.am
This diff is collapsed.
This diff is collapsed.
'kill-runaway-crx-ded' and 'launch-server' are shell scripts designed to emulate
running crx-ded as a persisant service under linux.
An example crontab that would check each server is running every ten minutes
would look like this:
*/10 * * * * /home/aa/cron/kill-runaway-crx-ded
*/10 * * * * /home/aa/cron/launch-server ctf.cfg >/dev/null 2>&1
*/10 * * * * /home/aa/cron/launch-server teamdm.cfg >/dev/null 2>&1
Additonally, a master server would have the following line in the crontab
(most people won't want this):
*/10 * * * * /home/aa/cron/check-master >/dev/null 2>&1
Don't forget to edit the launch-server/check-master scripts to set the paths
correctly for your executable.
'svstat' is a ruby script that will query local servers and produce some nice
output for server admin.
'rcon' is a ruby script that sends rcon commands to servers
'view-ip-log' is a shell script that parses the contents of the IP log.
#!/usr/bin/env ruby
=begin
ALIEN ARENA CONFIG CHECK (for server admins) V1.0
Copyright (C) 2009 Tony Jackson
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Tony Jackson can be contacted at tonyj@cooldark.com
=end
# Program starts here
# $* is array of args
if $*.include?('--help') then
puts ''
puts 'Server config check utility for Alien Arena'
puts ''
puts ' Checks map files listed in each .cfg sv_maplist are present in data1/maps'
puts ''
puts ' Usage:'
puts ' check-configs'
puts ' Optional arguments:'
puts ''
puts ' --help This message'
puts ' -all Also check against 3rd party maps in arena/maps directory'
puts ''
exit
end
mappath1st = "../../data1/maps/"
mappath3rd = "../../arena/maps/"
if File.exists?(mappath1st) and File.directory?(mappath1st) then
maps1stparty = Dir.entries(mappath1st)
else
maps1stparty = Array.new
end
if File.exists?(mappath3rd) and File.directory?(mappath3rd) then
maps3rdparty = Dir.entries(mappath3rd)
else
maps3rdparty = Array.new
end
Dir.foreach("../../arena/") do |entry|
if entry.split('.')[1] == 'cfg' then
cfgFile = File.open('../../arena/'+entry, 'r')
# read file and get sv_maplist line
while (line = cfgFile.gets)
if line.split(' ')[1] == 'sv_maplist' then
maplist = line.split(' ')[2..-1].map! {|map| map.gsub(/\"/, '') }
end
end
if maplist == nil then
puts "#{entry}: warning - sv_maplist not specified"
else
maplist.each { |map|
if $*.include?('-all') then
if !maps1stparty.include?(map+'.bsp') and !maps3rdparty.include?(map+'.bsp') then
puts "#{entry}: sv_maplist error - #{map}.bsp is not present in data1/maps or arena/maps"
end
else
if !maps1stparty.include?(map+'.bsp') then
puts "#{entry}: sv_maplist error - #{map}.bsp is not present in data1/maps"
end
end
}
end
cfgFile.close
end
end
#! /bin/sh
#
# AA Master Server - check alive
# Author: Tony Jackson
ulimit -c unlimited
### Master Directory
dir="/home/aa/master"
### Master Binary Name
bin="crmaster"
###############################
# Don't edit below this line! #
###############################
cd $dir
# check server is running
echo "Checking for master server..."
if `pidof $bin >/dev/null 2>&1`
then
echo "Master server is currently running."
exit 0
else
echo "Master server not running - restarting..."
./$bin &
fi
#!/bin/sh
for TPPID in `ps -eo pid,pcpu,comm | grep crx-ded | grep -v grep |
awk '{print $1":"$2}' |
awk 'BEGIN {FS=":"}{ if ($2 > 20.0){print $1} }'`
do
/bin/kill -9 $TPPID
done
#! /bin/sh
#
# AA Server Cron Job (originally TeamSpeak Cron Job)
#
# Usage: launch-server <configfile>
# EG: launch-server ctf.cfg
#
# Author: Chris Childers
# E-Mail: Chris@darkstarllc.com
# Modified by: Fafa Paku
# Modified by: Tony Jackson
# Updated for Alien Arena 2011
# 2010-12-04 FIXME: could benefit from some documentation.
#
# Set the port number in the .cfg if running multiple servers.
# Script checks the existance of the cfg file before launching.
# Uncomment this line if you want to get core dumps
#ulimit -c unlimited
### Set your default AA Root Directory
if [ $COR_GAME ] ; then
aadir=$COR_GAME
else
aadir=~/.codered
fi
### Set your AA Binary Name or command string ($1 is the argument
### passed to the script)
aabin="crx-ded +set game arena +exec $1"
########## you probably don't need to change anything below here
##########
if [ $1 ]
then
if test -r $aadir/arena/$1
then
echo "Found server config $aadir/arena/$1..."
else
echo "Unable to find server config $aadir/arena/$1."
exit 0
fi
else
echo "Usage: launch-server <configfile>"
exit 0
fi
aapid="$1.pid"
cd $aadir
# is there a pid file?
if test -r $aapid
then
# there is a pid file -- is it current?
pid=`cat $aapid`
if `kill -CHLD $pid >/dev/null 2>&1`
then
echo "Alien Arena is currently running...."
exit 0
fi
echo ""
echo "Stale $aapid file, erasing..."
echo "Attempting to Restart Alien Arena"
rm -f $aapid
$aabin &
ps aux | grep "$aabin" | grep -v grep | awk '{print $2}' > $aapid
else
echo "$aapid appears to be missing. Attempting to Restart Alien Arena"
$aabin &
ps aux | grep "$aabin" | grep -v grep | awk '{print $2}' > $aapid
fi
#!/bin/sh
#####################################
# ENTER CONFIGURATION DETAILS BELOW #
#####################################
name='Alien Arena'
execpath=/usr/local/bin
execname=crx-ded
if [ ${COR_GAME} ]; then
cfgpath=${COR_GAME}/arena
else
cfgpath=~/.codered/arena
fi
# use to generate core dumps after crashs
ulimit -c unlimited
#####################################
# END OF CONFIGURATION DETAILS #
# DO NOT EDIT BELOW THIS LINE! #
#####################################
# Written by Tony Jackson 14/07/2008
# Updated for Alien Arena 2011
#
# This script expects you to have screen installed, and soft links in the arena/
# directory to config files. The soft links must be named portXXXXX where XXXXX
# represents the port number that config should be served against. An example
# setup might look like this:
#
# lrwxrwxrwx 1 aa aa 7 Oct 13 2009 port27910 -> ffa.cfg
# lrwxrwxrwx 1 aa aa 7 Oct 13 2009 port27920 -> aoa.cfg
# lrwxrwxrwx 1 aa aa 9 Oct 13 2009 port27930 -> insta.cfg
# lrwxrwxrwx 1 aa aa 11 Apr 8 2010 port27940 -> emps1v1.cfg
# lrwxrwxrwx 1 aa aa 7 Oct 13 2009 port27950 -> ctf.cfg
# lrwxrwxrwx 1 aa aa 16 May 13 2010 port27960 -> empsinsta1v1.cfg
# lrwxrwxrwx 1 aa aa 18 Aug 24 00:54 port27970 -> empsrockets1v1.cfg
# lrwxrwxrwx 1 aa aa 8 Oct 25 2009 port27990 -> ictf.cfg
#
# A soft link is created by running 'ln -s ffa.cfg port27910'
#
# Running the script will launch each server in turn.
# If you run 'screen -ls' you will be shown a list of active screen sessions,
# which should include one called 'Alien_Arena'. This can be viewed by running
# 'screen -r Alien_Arena'. You can then switch between the console of each
# game as desired - see the screen documentation for how to do this.
cd $execpath
# remove spaces in name
sname=`echo ${name} | sed 's/\ /_/g'`
# check for existing screen session or start a new one
present=`screen -ls $sname | wc -l`
if [ $present != '2' ]; then
sname=`screen -ls $sname | awk 'NR==2{printf $1}'`
echo "[OK ] Screen session $sname"
else
# launch screen
screen -dmS $sname -t shell
echo "[STARTING] New screen session $sname"
fi
cd $cfgpath
for i in `ls port?????`; do
cd $cfgpath
# search config file for hostname and pull out
hostname=`cat $i | grep hostname | sed 's/set\ \|hostname\ \|\"//g'`
# extract port number from soft link name
port=`echo $i | sed 's/port//'`
title="Port $port => $hostname"
cd ${execpath}
# See if this process is already running
pid=`ps aux | grep $execname | grep $i | awk '{printf $2}'`
# See if pid existed for this config
if [ -z $pid ]; then
echo "[STARTING] $title"
# launch server and attach to existing screen session
screen -r $sname -X screen -t "$title" ./$execname +set dedicated 1 +set port $port +exec $i
else
echo "[OK ] $title"
fi
done
#!/bin/sh
# Random gravity script for Alien Arena
# Written by Tony Jackson 15/07/2008
#
# Configure below and run using:
# ./randomgravity &
# To stop use 'fg' and ctrl-c
# Calls Alien Arena rcon script - you must have ruby installed
########################
# CONFIGURATION #
########################
aapath=~/alienarena2008
serverip=localhost
serverport=27910
serverpass=your_rcon_pass_here
delay=5
maxgravity=1400
mingravity=100
########################
# END OF CONFIGURATION #
########################
# Do not edit below this line!
while [ 1 ]
do
sleep $delay
random=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" "`
random=$((($random%($maxgravity-$mingravity))+$mingravity))
# echo "Set gravity to $random"
$aapath/Tools/LinuxScripts/rcon $serverip:$serverport $serverpass set sv_gravity $random >/dev/null 2>&1
done
#!/usr/bin/env ruby
=begin
ALIEN ARENA RCON UTIL (for server admins) V1.0
Copyright (C) 2007 Tony Jackson
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Tony Jackson can be contacted at tonyj@cooldark.com
=end
require 'socket'
# send rcon string to all servers in array and get responses(not yet implemented)
def send_rcon(servers, password, message)
if servers == nil
return []
end
query = 'ÿÿÿÿrcon ' + password + ' ' + message + ' ' + "\x00"
connections = Hash.new
failed = Array.new
# Get the time before sending any packets, to time server response time (ping)
starttime = Time.now
# send a UDP packet to each server in the array
servers.each do
| server | # Here server is of form 'ip:port' string
begin
socket = UDPSocket.new # open works in the same way
socket.connect(server.split(':')[0], server.split(':')[1])
socket.send(query, 0)
#socket.send(nil, 0) # Test failure case
connections[socket] = server # hash keyed on socket resource, containing server string
rescue
puts 'Failed to send to server '+server
# some failure making a socket or sending a message - add to list of failed servers
#socket.close - can't use this - may not even be open
failed << server
next
end
end
# remove servers from list if socket failed to create/send UDP packet
servers -= failed
# check that we have at least one open UDP socket
if connections.length == 0
return servers
end
selectsocketlist = connections.keys # get list of sockets from hash
while result = select(selectsocketlist, nil, nil, 0.5) # select() waits for one or more socket to get a read event, or times out
ping = (Time.now - starttime)*1000
# store the time at which this server (or multiple servers) responded, and store the replies in our array of buffers
result[0].each do
|socket|
begin
# here connections[socket] gives us the 'ip:port' string of the associated server
puts 'Server '+connections[socket]+' replied in '+ping.to_s+'ms:'
reply = socket.recv(2048) # big enough to cover both games server replies and master reply with 256 servers (payload 12+6*256 bytes)
puts reply.split("