Blob Blame Raw
%define logwatch_root %{_datadir}/logwatch
%define logwatch_conf %{logwatch_root}/dist.conf
%define logwatch_scripts %{logwatch_root}/scripts

Name:           cyphesis
Version:        0.5.15
Release:        7%{?dist}
Summary:        WorldForge game server
Group:          System Environment/Libraries
# Would be GPLv2+, except server/protocol_instructions.h is GPLv2 only.
License:        GPLv2
Source4:        logwatch.logconf.cyphesis
Source5:        logwatch.script.cyphesis
Source6:        logwatch.serviceconf.cyphesis
Source7:        logwatch.shared.applycyphesisdate
Patch0:         cyphesis-0.5.15-init.patch
Patch1:         cyphesis-0.5.11-logdir.patch
Patch2:         cyphesis-0.5.15-gcc43.patch
Patch3:         cyphesis-0.5.15-sockpath.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  python-devel libgcrypt-devel pkgconfig atlascpp-devel
BuildRequires:  varconf-devel libsigc++20-devel mercator-devel skstream-devel
BuildRequires:  postgresql-devel readline-devel avahi-devel

Requires:       postgresql-server
Requires(pre): shadow-utils
Requires(post): /sbin/chkconfig
Requires(post): /sbin/service
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service

Obsoletes: cyphesis-selinux <= 0.5.15-6

Cyphesis is a WorldForge server suitable running small games. It is also
designed by be used as an AI subsystem in a network of distributed servers. It
includes a terrain engine based on the Mercator library, a persistence system
based on PostgreSQL, and an AI engine using goal trees implemented in Python.
It is the server used in most current WorldForge games.

%package logwatch
Summary: logwatch scripts for the WorldForge game server
Group: Amusements/Games
Requires: %{name} = %{version}-%{release} logwatch
%description logwatch
logwatch scripts for the WorldForge game server

%setup -q
%patch0 -p1
%patch1 -p0
%patch2 -p1
%patch3 -p1

# Fix a bug where DESTDIR is added twice to some files during the
# install step.  Upstream has been notified.
sed -i -e 's#moduledir = $(DESTDIR)#moduledir = #' rulesets/

chmod a-x rulesets/basic/mind/
chmod a-x rulesets/mason/world/objects/buildings/
chmod a-x rulesets/mason/world/objects/elements/

# Use a /etc/sysconfig/cyphesis variable to determine if
# we should load the world data into the cyphesis server
# via cyclient or not.  This should allow us to use a single
# init.d script for both starting cyphesis and populating the world.
echo "POPULATE_WORLD=1" >> cyphesis.sysconfig

# Use a /etc/sysconfig/cyphesis variable to determine if
# we should load the rules into the cyphesis server
# via cyloadrules or not.  This flag will be reset by the
# rpm whenever the game rules have changed and need to be reloaded
# after an upgrade/install.
echo "LOAD_RULES=1" >> cyphesis.sysconfig

make %{?_smp_mflags}

rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

install -d %{buildroot}%{_sysconfdir}/init.d
install -m 755 %{name}.init %{buildroot}%{_sysconfdir}/init.d/%{name}

install -d %{buildroot}%{_sysconfdir}/sysconfig
install -m 644 %{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}

# Install logwatch files
install -pD -m 0644 %{SOURCE4} %{buildroot}%{logwatch_conf}/logfiles/%{name}.conf
install -pD -m 0755 %{SOURCE5} %{buildroot}%{logwatch_scripts}/services/%{name}
install -pD -m 0644 %{SOURCE6} %{buildroot}%{logwatch_conf}/services/%{name}.conf
install -pD -m 0755 %{SOURCE7} %{buildroot}%{logwatch_scripts}/shared/applycyphesisdate

mkdir -p %{buildroot}%{_var}/log/%{name}
mkdir -p %{buildroot}%{_var}/run/%{name}

sed -i -e 's#unixport="#unixport="/var/run/cyphesis/#' $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/cyphesis.vconf

make check

getent group cyphesis >/dev/null || groupadd -r cyphesis
getent passwd cyphesis >/dev/null || \
       useradd -r -g cyphesis -d %{_datadir}/%{name} \
       -c "Cyphesis game server" cyphesis
cyphesis_shell=`getent passwd cyphesis | cut -d: -f 7`
if [ "$cyphesis_shell" == "/sbin/nologin" ] ; then
    chsh cyphesis -s /bin/bash
exit 0

/sbin/chkconfig --add cyphesis
# Make sure any new game rules are loaded into the database after
# an install or upgrade.
if ! grep -q LOAD_RULES %{_sysconfdir}/%{name} ; then
    sed -i -e 's/LOAD_RULES=.*/LOAD_RULES=1/' %{_sysconfdir}/sysconfig/%{name} 
    echo "LOAD_RULES=1" >> %{_sysconfdir}/sysconfig/%{name}

if [ "$1" = "0" ]; then
    /sbin/service cyphesis stop > /dev/null 2>&1
    /sbin/chkconfig --del cyphesis

if [ "$1" -ge "1" ]; then
    /sbin/service cyphesis condrestart >/dev/null 2>&1

rm -rf %{buildroot}

%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
# Package up the log and sock directory with special permissions so that the
# service can write to it.
%dir %attr(0755,cyphesis,cyphesis) %{_var}/log/%{name}
%dir %attr(0755,cyphesis,cyphesis) %{_var}/run/%{name}

%files logwatch

* Wed Apr 10 2008 Wart <wart at> 0.5.15-7
- Remove selinux subpackage; it's been merged into the main
  selinux-policy package.
- Add patch for using a full socket path in cyphesis.vconf

* Thu Feb 21 2008 Wart <wart at> 0.5.15-6
- Add patch to fix gcc4.3 build errors

* Wed Feb 20 2008 Fedora Release Engineering <> - 0.5.15-5
- Autorebuild for GCC 4.3

* Sun Feb 10 2008 Wart <wart at> 0.5.15-4
- Rebuild for gcc 4.3
- Add 'LOAD_RULES' setting in /etc/sysconfig/cyphesis to control
  reloading of the game rules data.

* Tue Dec 18 2007 Wart <wart at> 0.5.15-3
- Fix selinux permissions so that cyphesis can create its own
  log file.

* Tue Dec 18 2007 Wart <wart at> 0.5.15-2
- Move log files so they get they get the correct context

* Sun Dec 16 2007 Wart <wart at> 0.5.15-1
- Update to 0.5.15

* Sat Dec 15 2007 Wart <wart at> 0.5.14-2
- Change shell for cyphesis user on existing installs (BZ #425798)

* Sat Nov 3 2007 Wart <wart at> 0.5.14-1
- Update to 0.5.14

* Sun Aug 19 2007 Wart <wart at> 0.5.13-2
- License tag clarification
- Update user creation to conform to guidelines

* Tue Jul 17 2007 Wart <wart at> 0.5.13-1
- Update to 0.5.13

* Mon May 7 2007 Wart <wart at> 0.5.12-1
- Update to 0.5.12

* Sat Feb 24 2007 Wart <wart at> 0.5.11-2
- Add logwatch subpackage
- Move log file to /var/log directory

* Wed Jan 24 2007 Wart <wart at> 0.5.11-1
- Update to 0.5.11 with builtin python 2.5 support
- Updated selinux policy

* Thu Dec 14 2006 Wart <wart at> 0.5.10-4
- Patch and rebuild for python 2.5

* Wed Dec 6 2006 Wart <wart at> 0.5.10-3
- Rebuild for new postgresql

* Fri Dec 1 2006 Wart <wart at> 0.5.10-2
- Rebuild for new readline-devel

* Fri Oct 20 2006 Wart <wart at> 0.5.10-1
- Update to 0.5.10

* Mon Aug 28 2006 Wart <wart at> 0.5.9-2
- Use more globs in %%files section
- Remove unused -devel subpackage declaration

* Sat Aug 26 2006 Wart <wart at> 0.5.9-1
- Update to 0.5.9

* Sat Aug 5 2006 Wart <wart at> 0.5.8-5
- Move semanage calls to the init script so that we can be sure they are
  called if a system manager turns selinux on or off between installing
  the package and starting it.
- Remove FC4 bits from the spec file
- unghost the .pyo files per the recent packaging committee decision
- Don't bother explicitly creating a group for the cyphesis user

* Thu Aug 3 2006 Wart <wart at> 0.5.8-4
- Use find+sed in %%install instead of enumerating directories in %%files
- Remove the use of fedora-usermgmt.  There's no need.

* Tue Aug 1 2006 Wart <wart at> 0.5.8-3
- Clean up %%files

* Tue Aug 1 2006 Wart <wart at> 0.5.8-2
- Fix -init patch that was missing some key changes.

* Tue Aug 1 2006 Wart <wart at> 0.5.8-1
- Initial spec file for Fedora Extras