Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecd1e62fcb | ||
|
|
8ab9f9950a | ||
| 64ab6676d1 | |||
| f551637c8b | |||
| 1885d071a6 | |||
|
|
09cd30246d |
8 changed files with 281 additions and 40 deletions
0
.cvsignore → .gitignore
vendored
0
.cvsignore → .gitignore
vendored
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: xpilot-ng
|
||||
# $Id$
|
||||
NAME := xpilot-ng
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
13
logwatch.logconf.xpilot
Normal file
13
logwatch.logconf.xpilot
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
##########################################################################
|
||||
##########################################################################
|
||||
|
||||
# What actual file? Defaults to LogPath if not absolute path....
|
||||
LogFile = /var/log/xpilot.log
|
||||
|
||||
# Keep only the lines in the proper date range...
|
||||
*ApplyXpilotDate
|
||||
|
||||
# Search the rotated log files
|
||||
Archive = xpilot.log.*
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 et
|
||||
154
logwatch.script.xpilot
Executable file
154
logwatch.script.xpilot
Executable file
|
|
@ -0,0 +1,154 @@
|
|||
##########################################################################
|
||||
##########################################################################
|
||||
|
||||
use strict;
|
||||
|
||||
my ($pilot, $user, $ip, $version, $reason, $Msg, $total);
|
||||
my %Start = ();
|
||||
my %Login = ();
|
||||
my %TakeChar = ();
|
||||
my %Ping = ();
|
||||
my %Logout = ();
|
||||
|
||||
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
|
||||
|
||||
# Interesting events:
|
||||
#19 Feb 17:11:10 Server runs at 50 frames per second
|
||||
#21 Feb 05:54:27 Welcome Man=Tiago@UR| (217.129.39.100/3086) (version 4501)
|
||||
#21 Feb 05:54:28 Man (6) starts at startpos 0.
|
||||
#21 Feb 05:54:46 Checking Address:(217.129.39.100)
|
||||
#21 Feb 05:54:47 Checking Address:(217.129.39.100)
|
||||
#21 Feb 05:54:50 Checking Address:(217.129.39.100)
|
||||
#21 Feb 05:54:50 Checking Address:(217.129.39.100)
|
||||
#21 Feb 05:55:18 Goodbye Man=Tiago@UR| ("timeout 08")
|
||||
|
||||
|
||||
|
||||
while (defined(my $ThisLine = <STDIN>)) {
|
||||
chomp($ThisLine);
|
||||
if ( ($Msg) = ($ThisLine =~ /Server runs at .*$/)) {
|
||||
$Start{$Msg}++;
|
||||
} elsif ( ($pilot,$user,$ip,$version) = ($ThisLine =~ /Welcome ([^=]+)=([^|]+)\|.* \(([^\)]+)\) \(([^\)]+)\)$/)) {
|
||||
$Login{$pilot}{$user}{$ip}{$version}++;
|
||||
} elsif ( ($pilot) = ($ThisLine =~ /([^ ]+) \(\d+\) starts at startpos/)) {
|
||||
$TakeChar{$pilot}++;
|
||||
} elsif ( ($ip) = ($ThisLine =~ /Checking Address:\((.*)\)$/)) {
|
||||
$Ping{$ip}++;
|
||||
} elsif ( ($pilot,$user,$reason) = ($ThisLine =~ /Goodbye ([^=]+)=([^|]+)\|.* \((.*)\)$/)) {
|
||||
$Logout{$pilot}{$user}{$reason}++;
|
||||
}
|
||||
}
|
||||
|
||||
if (keys %Start) {
|
||||
if ($Detail >= 5) {
|
||||
foreach my $Msg (sort keys %Start) {
|
||||
if ($Start{$Msg} > 1) {
|
||||
print "Server started ($Start{$Msg} times)\n";
|
||||
} else {
|
||||
print "Server started once\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $total;
|
||||
foreach my $Msg (keys %Start) {
|
||||
$total += $Start{$Msg};
|
||||
}
|
||||
print "Server started $total times\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (keys %Login) {
|
||||
print "\n";
|
||||
if ($Detail >= 5) {
|
||||
foreach my $pilot (sort keys %Login) {
|
||||
foreach my $user (sort keys %{ $Login{$pilot} }) {
|
||||
my $total=0;
|
||||
foreach my $ip (keys %{ $Login{$pilot}{$user} }) {
|
||||
foreach my $version (keys %{ $Login{$pilot}{$user}{$ip} }) {
|
||||
$total += $Login{$pilot}{$user}{$ip}{$version};
|
||||
}
|
||||
}
|
||||
print "Pilot $pilot ($user) logged in $total times\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $total;
|
||||
foreach my $pilot (keys %Login) {
|
||||
foreach my $user (keys %{ $Login{$pilot} }) {
|
||||
foreach my $ip (keys %{ $Login{$pilot}{$user} }) {
|
||||
foreach my $version (keys %{ $Login{$pilot}{$user}{$ip} }) {
|
||||
$total += $Login{$pilot}{$user}{$ip}{$version};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "$total users logged in\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (keys %TakeChar) {
|
||||
print "\n";
|
||||
if ($Detail >= 5) {
|
||||
foreach my $pilot (sort keys %TakeChar) {
|
||||
if ($TakeChar{$pilot} > 1) {
|
||||
print "Player $pilot joined $TakeChar{$pilot} times\n"
|
||||
} else {
|
||||
print "Player $pilot joined once\n"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $total=0;
|
||||
foreach my $pilot (keys %TakeChar) {
|
||||
$total += $TakeChar{$pilot};
|
||||
}
|
||||
print "$total players entered the world\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (keys %Logout) {
|
||||
print "\n";
|
||||
if ($Detail >= 5) {
|
||||
foreach my $pilot (sort keys %Logout) {
|
||||
foreach my $user (sort keys %{ $Logout{$pilot} }) {
|
||||
foreach my $reason (keys %{ $Logout{$pilot}{$user} }) {
|
||||
print "Pilot $pilot ($user) logged out $Logout{$pilot}{$user}{$reason} times ($reason)\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $total=0;
|
||||
foreach my $pilot (keys %Logout) {
|
||||
foreach my $user (keys %{ $Logout{$pilot} }) {
|
||||
foreach my $reason (keys %{ $Logout{$pilot}{$user} }) {
|
||||
$total += $Logout{$pilot}{$user}{$reason};
|
||||
}
|
||||
}
|
||||
}
|
||||
print "$total users logged out\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (keys %Ping) {
|
||||
print "\n";
|
||||
if ($Detail >= 5) {
|
||||
foreach my $ip (sort keys %Ping) {
|
||||
if ($Ping{$ip} > 1) {
|
||||
printf "Pinged %-16s %3d times\n", ($ip,$Ping{$ip})
|
||||
} else {
|
||||
printf "Pinged %-16s once\n", ($ip)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $total=0;
|
||||
foreach my $ip (keys %Ping) {
|
||||
$total += $Ping{$ip};
|
||||
}
|
||||
print "Pinged " . keys(%Ping) . " hosts $total times\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exit(0);
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 syntax=perl et
|
||||
|
||||
19
logwatch.serviceconf.xpilot
Normal file
19
logwatch.serviceconf.xpilot
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
###########################################################################
|
||||
###########################################################################
|
||||
|
||||
# You can put comments anywhere you want to. They are effective for the
|
||||
# rest of the line.
|
||||
|
||||
# this is in the format of <name> = <value>. Whitespace at the beginning
|
||||
# and end of the lines is removed. Whitespace before and after the = sign
|
||||
# is removed. Everything is case *insensitive*.
|
||||
|
||||
# Yes = True = On = 1
|
||||
# No = False = Off = 0
|
||||
|
||||
Title = "Xpilot"
|
||||
|
||||
# Which logfile group...
|
||||
LogFile = xpilot-ng
|
||||
|
||||
# vi: shiftwidth=3 tabstop=3 et
|
||||
21
logwatch.shared.applyxpilotdate
Executable file
21
logwatch.shared.applyxpilotdate
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
##########################################################################
|
||||
##########################################################################
|
||||
|
||||
use Logwatch ':dates';
|
||||
|
||||
my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
|
||||
|
||||
$SearchDate = TimeFilter('%d %b %H:%M:%S');
|
||||
|
||||
if ( $Debug > 5 ) {
|
||||
print STDERR "DEBUG: Inside ApplyXpilotDate...\n";
|
||||
print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
|
||||
}
|
||||
|
||||
while (defined($ThisLine = <STDIN>)) {
|
||||
if ($ThisLine =~ m/^$SearchDate /o) {
|
||||
print $ThisLine;
|
||||
}
|
||||
}
|
||||
|
||||
# vi: shiftwidth=3 syntax=perl tabstop=3 et
|
||||
19
xpilot-ng-4.7.2-scoreassert.patch
Normal file
19
xpilot-ng-4.7.2-scoreassert.patch
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--- src/server/score.c.orig 2006-10-20 11:38:01.000000000 -0700
|
||||
+++ src/server/score.c 2006-10-20 12:44:30.000000000 -0700
|
||||
@@ -257,9 +257,13 @@
|
||||
sc = Rate(cannon->score, Get_Score(victim))
|
||||
* options.cannonKillScoreMult;
|
||||
else {
|
||||
- assert(((object_t *) extra)->id == NO_ID);
|
||||
- sc = Rate(UNOWNED_SCORE, Get_Score(victim))
|
||||
- * options.cannonKillScoreMult;
|
||||
+ //assert(((object_t *) extra)->id == NO_ID);
|
||||
+ if ( ((object_t *) extra)->id != NO_ID) {
|
||||
+ fprintf(stderr, "((object_t *) extra)->id == NO_ID assertion failed\n");
|
||||
+ } else {
|
||||
+ sc = Rate(UNOWNED_SCORE, Get_Score(victim))
|
||||
+ * options.cannonKillScoreMult;
|
||||
+ }
|
||||
}
|
||||
} else if (((object_t *) extra)->id == NO_ID) {
|
||||
sc = Rate(0.0,
|
||||
|
|
@ -1,15 +1,19 @@
|
|||
%define selinux_variants mls strict targeted
|
||||
%define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp)
|
||||
|
||||
%define logwatch_root %{_datadir}/logwatch
|
||||
%define logwatch_conf %{logwatch_root}/dist.conf
|
||||
%define logwatch_scripts %{logwatch_root}/scripts
|
||||
|
||||
Name: xpilot-ng
|
||||
Version: 4.7.2
|
||||
Release: 10%{?dist}
|
||||
Release: 12%{?dist}
|
||||
Summary: Multiplayer space arcade game
|
||||
|
||||
Group: Amusements/Games
|
||||
License: GPL
|
||||
License: GPLv2+
|
||||
URL: http://xpilot.sourceforge.net
|
||||
Source0: http://dl.sourceforge.net/sourceforge/xpilot/xpilot-ng-%{version}.tar.gz
|
||||
Source0: http://downloads.sourceforge.net/xpilot/xpilot-ng-%{version}.tar.gz
|
||||
Source1: xpilot-ng.png
|
||||
Source2: xpilot-ng-x11.desktop
|
||||
Source3: xpilot-ng-sdl.desktop
|
||||
|
|
@ -19,15 +23,17 @@ Source6: xpilot-ng.logrotate
|
|||
Source7: xpilotd.te
|
||||
Source8: xpilotd.fc
|
||||
Source9: xpilotd.if
|
||||
Source10: logwatch.logconf.xpilot
|
||||
Source11: logwatch.script.xpilot
|
||||
Source12: logwatch.serviceconf.xpilot
|
||||
Source13: logwatch.shared.applyxpilotdate
|
||||
Patch0: xpilot-ng-4.7.2-scoreassert.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: expat-devel SDL_ttf-devel SDL_image-devel zlib-devel
|
||||
BuildRequires: libXt-devel libGLU-devel libXxf86misc-devel
|
||||
BuildRequires: selinux-policy-devel hardlink checkpolicy
|
||||
%if "%{selinux_policyver}" != ""
|
||||
Requires: selinux-policy >= %{selinux_policyver}
|
||||
%endif
|
||||
|
||||
%description
|
||||
A highly addictive, infinitely configurable multiplayer space
|
||||
|
|
@ -43,8 +49,6 @@ Requires(post): /sbin/service
|
|||
Requires(preun): /sbin/chkconfig
|
||||
Requires(preun): /sbin/service
|
||||
Requires(postun): /sbin/service
|
||||
Requires(pre): fedora-usermgmt
|
||||
Requires(postun): fedora-usermgmt
|
||||
%description server
|
||||
The xpilot server. This allows you to host xpilot games on your
|
||||
computer and develop new xpilot maps. This is required if you
|
||||
|
|
@ -55,14 +59,25 @@ public xpilot games hosted on the internet.
|
|||
Summary: SELinux policy files for the xpilot-ng game server
|
||||
Group: Amusements/Games
|
||||
Requires: %{name}-server = %{version}-%{release}
|
||||
%if "%{selinux_policyver}" != ""
|
||||
Requires: selinux-policy >= %{selinux_policyver}
|
||||
%endif
|
||||
Requires(post): /usr/sbin/semodule /usr/sbin/semanage /sbin/fixfiles
|
||||
Requires(preun): /sbin/service /usr/sbin/semodule /usr/sbin/semanage /sbin/fixfiles /usr/sbin/setsebool
|
||||
Requires(postun): /usr/sbin/semodule
|
||||
%description selinux
|
||||
SELinux policy files for the xpilot-ng game server
|
||||
|
||||
%package logwatch
|
||||
Summary: logwatch scripts for the xpilot game server
|
||||
Group: Amusements/Games
|
||||
Requires: %{name}-server = %{version}-%{release} logwatch
|
||||
%description logwatch
|
||||
logwatch scripts for the Xpilot game server
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0
|
||||
pushd doc/man
|
||||
iconv --from=ISO-8859-1 --to=UTF-8 xpilot-ng-server.man > xpilot-ng-server.man.new
|
||||
mv xpilot-ng-server.man.new xpilot-ng-server.man
|
||||
|
|
@ -95,11 +110,9 @@ chmod a+x $RPM_BUILD_ROOT/%{_datadir}/%{name}/mapconvert.py
|
|||
|
||||
desktop-file-install --vendor fedora \
|
||||
--dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
|
||||
--add-category X-Fedora \
|
||||
%{SOURCE2}
|
||||
desktop-file-install --vendor fedora \
|
||||
--dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
|
||||
--add-category X-Fedora \
|
||||
%{SOURCE3}
|
||||
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/
|
||||
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/
|
||||
|
|
@ -117,17 +130,23 @@ install -p -D -m 644 %{SOURCE6} \
|
|||
install -p -D -m 644 lib/defaults.txt $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/defaults.txt
|
||||
install -p -D -m 600 lib/password.txt $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/password.txt
|
||||
|
||||
# Install logwatch files
|
||||
install -pD -m 0644 %{SOURCE10} $RPM_BUILD_ROOT%{logwatch_conf}/logfiles/%{name}.conf
|
||||
install -pD -m 0755 %{SOURCE11} $RPM_BUILD_ROOT%{logwatch_scripts}/services/%{name}
|
||||
install -pD -m 0644 %{SOURCE12} $RPM_BUILD_ROOT%{logwatch_conf}/services/%{name}.conf
|
||||
install -pD -m 0755 %{SOURCE13} $RPM_BUILD_ROOT%{logwatch_scripts}/shared/applyxpilotdate
|
||||
|
||||
# Install selinux policies
|
||||
pushd SELinux
|
||||
for variant in %{selinux_variants}
|
||||
do
|
||||
install -d %{buildroot}%{_datadir}/selinux/${variant}
|
||||
install -d $RPM_BUILD_ROOT%{_datadir}/selinux/${variant}
|
||||
install -p -m 644 xpilotd.pp.${variant} \
|
||||
%{buildroot}%{_datadir}/selinux/${variant}/xpilotd.pp
|
||||
$RPM_BUILD_ROOT%{_datadir}/selinux/${variant}/xpilotd.pp
|
||||
done
|
||||
popd
|
||||
# Hardlink identical policy module packages together
|
||||
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
|
||||
/usr/sbin/hardlink -cv $RPM_BUILD_ROOT%{_datadir}/selinux
|
||||
|
||||
%post
|
||||
touch --no-create %{_datadir}/icons/hicolor || :
|
||||
|
|
@ -144,9 +163,9 @@ fi
|
|||
%pre server
|
||||
user_uid=`id -u xpilot 2>/dev/null`
|
||||
if [ x"$user_uid" = x ] ; then
|
||||
/usr/sbin/fedora-groupadd 25 -r xpilot &>/dev/null || :
|
||||
/usr/sbin/fedora-useradd 25 -r -s /sbin/nologin -d /usr/share/xpilot-ng \
|
||||
-M -c 'XPilot Server' -g xpilot xpilot >/dev/null || :
|
||||
useradd -r -s /sbin/nologin -d %{_datadir}/%{name} -M \
|
||||
-c 'XPilot Server' \
|
||||
xpilot >/dev/null || :
|
||||
fi
|
||||
|
||||
%post server
|
||||
|
|
@ -162,8 +181,6 @@ fi
|
|||
if [ "$1" -ge "1" ]; then
|
||||
/sbin/service xpilot-ng-server condrestart > /dev/null 2>&1
|
||||
fi
|
||||
test "$1" != 0 || /usr/sbin/fedora-userdel xpilot &>/dev/null || :
|
||||
test "$1" != 0 || /usr/sbin/fedora-groupdel xpilot &>/dev/null || :
|
||||
|
||||
%post selinux
|
||||
# Install SELinux policy modules
|
||||
|
|
@ -229,7 +246,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-server
|
||||
%{_datadir}/%{name}
|
||||
%dir %{_sysconfdir}/%{name}
|
||||
%config(noreplace) %attr(0600,xpilot,xpilot) %{_sysconfdir}/%{name}/password.txt
|
||||
%config(noreplace) %attr(0600,xpilot,root) %{_sysconfdir}/%{name}/password.txt
|
||||
%config(noreplace) %{_sysconfdir}/%{name}/defaults.txt
|
||||
%{_mandir}/man6/xpilot-ng-server.6.gz
|
||||
%{_mandir}/man6/xpilot-ng-xp-mapedit.6.gz
|
||||
|
|
@ -240,7 +257,26 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%doc SELinux/*.??
|
||||
%{_datadir}/selinux/*/xpilotd.pp
|
||||
|
||||
%files logwatch
|
||||
%defattr(-,root,root,-)
|
||||
%{logwatch_conf}/logfiles/%{name}.conf
|
||||
%{logwatch_conf}/services/%{name}.conf
|
||||
%{logwatch_scripts}/services/%{name}
|
||||
%{logwatch_scripts}/shared/applyxpilotdate
|
||||
|
||||
%changelog
|
||||
- License tag clarification
|
||||
- Remove X-Fedora from .desktop file
|
||||
- Better download URL
|
||||
|
||||
* Fri Feb 23 2007 Wart <wart at kobold.org> 4.7.2-12
|
||||
- Update logwatch script with a previously unknown log field
|
||||
|
||||
* Thu Feb 22 2007 Wart <wart at kobold.org> 4.7.2-11
|
||||
- Add patch to prevent crash when running with robots not in idle mode
|
||||
- Added logwatch files
|
||||
- Switch from fedora-usermgmt to vanilla useradd
|
||||
|
||||
* Tue Aug 29 2006 Wart <wart at kobold.org> 4.7.2-10
|
||||
- Added SELinux policies for the game server
|
||||
- Don't attempt to create the xpilot user if it already exists
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue