Michael Thomas 6a90090
%define selinux_variants mls strict targeted
Michael Thomas 6a90090
%define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp)
Michael Thomas 6a90090
Michael Thomas 79a2e45
%define logwatch_root %{_datadir}/logwatch
Michael Thomas 79a2e45
%define logwatch_conf %{logwatch_root}/dist.conf
Michael Thomas 79a2e45
%define logwatch_scripts %{logwatch_root}/scripts
Michael Thomas 79a2e45
Michael Thomas 6a90090
Name:           cyphesis
Michael Thomas 6f2ad09
Version:        0.5.15
Michael Thomas 6f2ad09
Release:        1%{?dist}
Michael Thomas 6a90090
Summary:        WorldForge game server
Michael Thomas 6a90090
Group:          System Environment/Libraries
Michael Thomas 09ff066
# Would be GPLv2+, except server/protocol_instructions.h is GPLv2 only.
Michael Thomas 09ff066
License:        GPLv2
Michael Thomas 6a90090
URL:            http://www.worldforge.org
Michael Thomas 36713b8
Source0:        http://downloads.sourceforge.net/worldforge/%{name}-%{version}.tar.gz
Michael Thomas 6a90090
Source1:        cyphesis.te
Michael Thomas 6a90090
Source2:        cyphesis.if
Michael Thomas 6a90090
Source3:        cyphesis.fc
Michael Thomas 79a2e45
Source4:        logwatch.logconf.cyphesis
Michael Thomas 79a2e45
Source5:        logwatch.script.cyphesis
Michael Thomas 79a2e45
Source6:        logwatch.serviceconf.cyphesis
Michael Thomas 79a2e45
Source7:        logwatch.shared.applycyphesisdate
Michael Thomas 5a6f3ef
Patch0:         cyphesis-0.5.8-init.patch
Michael Thomas 6a90090
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Michael Thomas 6a90090
BuildRequires:  python-devel libgcrypt-devel pkgconfig atlascpp-devel
Michael Thomas 6a90090
BuildRequires:  varconf-devel libsigc++20-devel mercator-devel skstream-devel
Michael Thomas 6a90090
BuildRequires:  postgresql-devel readline-devel avahi-devel
Michael Thomas 6a90090
BuildRequires:  checkpolicy selinux-policy-devel hardlink
Michael Thomas 6a90090
Michael Thomas 6a90090
Requires:       postgresql-server
Michael Thomas 09ff066
Requires(pre): shadow-utils
Michael Thomas 6a90090
Requires(post): /sbin/chkconfig
Michael Thomas 6a90090
Requires(post): /sbin/service
Michael Thomas 6a90090
Requires(preun): /sbin/chkconfig
Michael Thomas 6a90090
Requires(preun): /sbin/service
Michael Thomas 6a90090
Requires(postun): /sbin/service
Michael Thomas 6a90090
Michael Thomas 6a90090
%description
Michael Thomas 6a90090
Cyphesis is a WorldForge server suitable running small games. It is also
Michael Thomas 6a90090
designed by be used as an AI subsystem in a network of distributed servers. It
Michael Thomas 6a90090
includes a terrain engine based on the Mercator library, a persistence system
Michael Thomas 6a90090
based on PostgreSQL, and an AI engine using goal trees implemented in Python.
Michael Thomas 6a90090
It is the server used in most current WorldForge games.
Michael Thomas 6a90090
Michael Thomas 6a90090
Michael Thomas 6a90090
%package selinux
Michael Thomas 6a90090
Summary: SELinux policy files for the WorldForge game server
Michael Thomas 6a90090
Group: Amusements/Games
Michael Thomas 6a90090
Requires: %{name} = %{version}-%{release}
Michael Thomas 79a2e45
%if "%{selinux_policyver}" != ""
Michael Thomas 79a2e45
Requires:       selinux-policy >= %{selinux_policyver}
Michael Thomas 79a2e45
%endif
Michael Thomas 6a90090
Requires(post):         /usr/sbin/semodule /usr/sbin/semanage /sbin/fixfiles
Michael Thomas 6a90090
Requires(preun):        /sbin/service /usr/sbin/semodule /usr/sbin/semanage /sbin/fixfiles /usr/sbin/setsebool
Michael Thomas 6a90090
Requires(postun):       /usr/sbin/semodule
Michael Thomas 6a90090
%description selinux
Michael Thomas 6a90090
SELinux policy files for the WorldForge game server
Michael Thomas 6a90090
Michael Thomas 79a2e45
%package logwatch
Michael Thomas 79a2e45
Summary: logwatch scripts for the WorldForge game server
Michael Thomas 79a2e45
Group: Amusements/Games
Michael Thomas 79a2e45
Requires: %{name} = %{version}-%{release} logwatch
Michael Thomas 79a2e45
%description logwatch
Michael Thomas 79a2e45
logwatch scripts for the WorldForge game server
Michael Thomas 79a2e45
Michael Thomas 6a90090
Michael Thomas 6a90090
%prep
Michael Thomas 6a90090
%setup -q
Michael Thomas 6a90090
%patch0
Michael Thomas 6a90090
Michael Thomas f2790d0
# Fix a bug where DESTDIR is added twice to some files during the
Michael Thomas f2790d0
# install step.  Upstream has been notified.
Michael Thomas f2790d0
sed -i -e 's#moduledir = $(DESTDIR)#moduledir = #' rulesets/Makefile.in
Michael Thomas f2790d0
Michael Thomas 6a90090
chmod a-x rulesets/basic/mind/dictlist.py
Michael Thomas f2790d0
chmod a-x rulesets/mason/world/objects/buildings/House.py
Michael Thomas f2790d0
chmod a-x rulesets/mason/world/objects/elements/Fire.py
Michael Thomas 6a90090
mkdir SELinux
Michael Thomas 6a90090
cp  %{SOURCE1} %{SOURCE2} %{SOURCE3} SELinux/
Michael Thomas 6a90090
Michael Thomas 6a90090
# Use a /etc/sysconfig/cyphesis variable to determine if
Michael Thomas 6a90090
# we should load the world data into the cyphesis server
Michael Thomas 6a90090
# via cyclient or not.  This should allow us to use a single
Michael Thomas 6a90090
# init.d script for both starting cyphesis and populating the world.
Michael Thomas 6a90090
echo "POPULATE_WORLD=1" >> cyphesis.sysconfig
Michael Thomas 6a90090
Michael Thomas 6a90090
Michael Thomas 6a90090
%build
Michael Thomas 6a90090
%configure
Michael Thomas 6a90090
make %{?_smp_mflags}
Michael Thomas 6a90090
Michael Thomas 6a90090
# Build the selinux policy file
Michael Thomas 6a90090
pushd SELinux
Michael Thomas 6a90090
for variant in %{selinux_variants}
Michael Thomas 6a90090
do
Michael Thomas 6a90090
    make NAME=${variant} -f %{_datadir}/selinux/devel/Makefile
Michael Thomas 6a90090
    mv %{name}.pp %{name}.pp.${variant}
Michael Thomas 6a90090
    make NAME=${variant} -f %{_datadir}/selinux/devel/Makefile clean
Michael Thomas 6a90090
done
Michael Thomas 6a90090
popd
Michael Thomas 6a90090
Michael Thomas 6a90090
%install
Michael Thomas 6a90090
rm -rf %{buildroot}
Michael Thomas 6a90090
make install DESTDIR=%{buildroot}
Michael Thomas 6a90090
Michael Thomas 6a90090
install -d %{buildroot}%{_sysconfdir}/init.d
Michael Thomas 6a90090
install -m 755 %{name}.init %{buildroot}%{_sysconfdir}/init.d/%{name}
Michael Thomas 6a90090
Michael Thomas 6a90090
install -d %{buildroot}%{_sysconfdir}/sysconfig
Michael Thomas 6a90090
install -m 644 %{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
Michael Thomas 6a90090
Michael Thomas 79a2e45
# Install logwatch files
Michael Thomas 79a2e45
install -pD -m 0644 %{SOURCE4} %{buildroot}%{logwatch_conf}/logfiles/%{name}.conf
Michael Thomas 79a2e45
install -pD -m 0755 %{SOURCE5} %{buildroot}%{logwatch_scripts}/services/%{name}
Michael Thomas 79a2e45
install -pD -m 0644 %{SOURCE6} %{buildroot}%{logwatch_conf}/services/%{name}.conf
Michael Thomas 79a2e45
install -pD -m 0755 %{SOURCE7} %{buildroot}%{logwatch_scripts}/shared/applycyphesisdate
Michael Thomas 79a2e45
Michael Thomas 79a2e45
Michael Thomas 6a90090
# Install selinux policies
Michael Thomas 6a90090
pushd SELinux
Michael Thomas 6a90090
for variant in %{selinux_variants}
Michael Thomas 6a90090
do
Michael Thomas 6a90090
    install -d %{buildroot}%{_datadir}/selinux/${variant}
Michael Thomas 6a90090
    install -p -m 644 %{name}.pp.${variant} \
Michael Thomas 6a90090
           %{buildroot}%{_datadir}/selinux/${variant}/%{name}.pp
Michael Thomas 6a90090
done
Michael Thomas 6a90090
popd
Michael Thomas 6a90090
# Hardlink identical policy module packages together
Michael Thomas 6a90090
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
Michael Thomas 6a90090
Michael Thomas 6a90090
%check
Michael Thomas 6a90090
make check
Michael Thomas 6a90090
Michael Thomas 6a90090
%pre
Michael Thomas 09ff066
getent group cyphesis >/dev/null || groupadd -r cyphesis
Michael Thomas 09ff066
getent passwd cyphesis >/dev/null || \
Michael Thomas 90538d4
       useradd -r -g cyphesis -d %{_datadir}/%{name} \
Michael Thomas 90538d4
       -c "Cyphesis game server" cyphesis
Michael Thomas 508e5ab
cyphesis_shell=`getent passwd cyphesis | cut -d: -f 7`
Michael Thomas 508e5ab
if [ "$cyphesis_shell" == "/sbin/nologin" ] ; then
Michael Thomas 508e5ab
    chsh cyphesis -s /bin/bash
Michael Thomas 508e5ab
fi
Michael Thomas 09ff066
exit 0
Michael Thomas 6a90090
Michael Thomas 6a90090
%post
Michael Thomas 6a90090
/sbin/chkconfig --add cyphesis
Michael Thomas 6a90090
Michael Thomas 6a90090
%post selinux
Michael Thomas 6a90090
# Install SELinux policy modules
Michael Thomas 6a90090
for selinuxvariant in %{selinux_variants}
Michael Thomas 6a90090
do
Michael Thomas 6a90090
  /usr/sbin/semodule -s ${selinuxvariant} -i \
Michael Thomas 6a90090
    %{_datadir}/selinux/${selinuxvariant}/%{name}.pp &> /dev/null || :
Michael Thomas 6a90090
done
Michael Thomas 6a90090
/usr/sbin/semanage port -a -t %{name}_port_t -p tcp 6767 &> /dev/null || :
Michael Thomas 6a90090
/usr/sbin/semanage port -a -t %{name}_port_t -p tcp 6769 &> /dev/null || :
Michael Thomas 6a90090
/usr/sbin/semanage port -a -t %{name}_port_t -p udp 32771 &> /dev/null || :
Michael Thomas 6a90090
/sbin/fixfiles -R %{name} restore || :
Michael Thomas 6a90090
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
Michael Thomas 6a90090
Michael Thomas 6a90090
Michael Thomas 6a90090
%preun
Michael Thomas 6a90090
if [ "$1" = "0" ]; then
Michael Thomas 6a90090
    /sbin/service cyphesis stop > /dev/null 2>&1
Michael Thomas 6a90090
    /sbin/chkconfig --del cyphesis
Michael Thomas 6a90090
fi
Michael Thomas 6a90090
Michael Thomas 6a90090
%preun selinux
Michael Thomas 6a90090
if [ "$1" -lt "1" ] ; then
Michael Thomas 6a90090
    # Disable the policy and restart the daemon
Michael Thomas 6a90090
    /usr/sbin/setsebool %{name}_disable_trans 1 &> /dev/null || :
Michael Thomas 6a90090
    /sbin/service %{name} condrestart > /dev/null 2>&1 || :
Michael Thomas 6a90090
    # Unload the module
Michael Thomas 6a90090
    /usr/sbin/semanage port -d -t %{name}_port_t -p tcp 6767 &> /dev/null || :
Michael Thomas 6a90090
    /usr/sbin/semanage port -d -t %{name}_port_t -p tcp 6769 &> /dev/null || :
Michael Thomas 6a90090
    /usr/sbin/semanage port -d -t %{name}_port_t -p udp 32771 &> /dev/null || :
Michael Thomas 6a90090
    for variant in %{selinux_variants} ; do
Michael Thomas 6a90090
        /usr/sbin/semodule -s ${variant} -r %{name} &> /dev/null || :
Michael Thomas 6a90090
    done
Michael Thomas 6a90090
    # Set the context back
Michael Thomas 6a90090
    /sbin/fixfiles -R %{name} restore || :
Michael Thomas 6a90090
fi
Michael Thomas 6a90090
Michael Thomas 6a90090
%postun
Michael Thomas 6a90090
if [ "$1" -ge "1" ]; then
Michael Thomas 6a90090
    /sbin/service cyphesis condrestart >/dev/null 2>&1
Michael Thomas 6a90090
fi
Michael Thomas 6a90090
Michael Thomas 6a90090
%postun selinux
Michael Thomas 6a90090
if [ "$1" -ge "1" ] ; then
Michael Thomas 6a90090
    # Replace the module if it is already loaded. semodule -u also
Michael Thomas 6a90090
    # checks the module version
Michael Thomas 6a90090
    for variant in %{selinux_variants} ; do
Michael Thomas 6a90090
        /usr/sbin/semodule -u %{_datadir}/selinux/${variant}/%{name}.pp || :
Michael Thomas 6a90090
    done
Michael Thomas 6a90090
fi
Michael Thomas 6a90090
Michael Thomas 6a90090
%clean
Michael Thomas 6a90090
rm -rf %{buildroot}
Michael Thomas 6a90090
Michael Thomas 6a90090
Michael Thomas 6a90090
%files
Michael Thomas 6a90090
%defattr(-,root,root,-)
Michael Thomas 6a90090
%doc AUTHORS ChangeLog COPYING README NEWS THANKS TODO
Michael Thomas 6a90090
%{_bindir}/cy*
Michael Thomas f2790d0
%{_datadir}/%{name}
Michael Thomas 6a90090
%{_mandir}/man1/*.1.gz
Michael Thomas 6a90090
%dir %{_sysconfdir}/%{name}
Michael Thomas 6a90090
%config(noreplace) %{_sysconfdir}/%{name}/*
Michael Thomas 6a90090
%{_sysconfdir}/init.d/%{name}
Michael Thomas 6a90090
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
Michael Thomas 6a90090
Michael Thomas 79a2e45
%files logwatch
Michael Thomas 79a2e45
%defattr(-,root,root,-)
Michael Thomas 79a2e45
%{logwatch_conf}/logfiles/%{name}.conf
Michael Thomas 79a2e45
%{logwatch_conf}/services/%{name}.conf
Michael Thomas 79a2e45
%{logwatch_scripts}/services/%{name}
Michael Thomas 79a2e45
%{logwatch_scripts}/shared/applycyphesisdate
Michael Thomas 79a2e45
Michael Thomas 6a90090
%files selinux
Michael Thomas 6a90090
%defattr(-,root,root,-)
Michael Thomas 6a90090
%doc SELinux/*.??
Michael Thomas 6a90090
%{_datadir}/selinux/*/%{name}.pp
Michael Thomas 6a90090
Michael Thomas 6a90090
Michael Thomas 6a90090
%changelog
Michael Thomas 6f2ad09
* Sun Dec 16 2007 Wart <wart at kobold.org> 0.5.15-1
Michael Thomas 6f2ad09
- Update to 0.5.15
Michael Thomas 6f2ad09
Michael Thomas 508e5ab
* Sat Dec 15 2007 Wart <wart at kobold.org> 0.5.14-2
Michael Thomas 508e5ab
- Change shell for cyphesis user on existing installs (BZ #425798)
Michael Thomas 508e5ab
Michael Thomas 90538d4
* Sat Nov 3 2007 Wart <wart at kobold.org> 0.5.14-1
Michael Thomas 90538d4
- Update to 0.5.14
Michael Thomas 90538d4
Michael Thomas 09ff066
* Sun Aug 19 2007 Wart <wart at kobold.org> 0.5.13-2
Michael Thomas 09ff066
- License tag clarification
Michael Thomas 09ff066
- Update user creation to conform to guidelines
Michael Thomas 09ff066
Michael Thomas f2790d0
* Tue Jul 17 2007 Wart <wart at kobold.org> 0.5.13-1
Michael Thomas f2790d0
- Update to 0.5.13
Michael Thomas f2790d0
Michael Thomas 36713b8
* Mon May 7 2007 Wart <wart at kobold.org> 0.5.12-1
Michael Thomas 36713b8
- Update to 0.5.12
Michael Thomas 36713b8
Michael Thomas 79a2e45
* Sat Feb 24 2007 Wart <wart at kobold.org> 0.5.11-2
Michael Thomas 79a2e45
- Add logwatch subpackage
Michael Thomas 79a2e45
- Move log file to /var/log directory
Michael Thomas 79a2e45
Michael Thomas 4619126
* Wed Jan 24 2007 Wart <wart at kobold.org> 0.5.11-1
Michael Thomas 79a2e45
- Update to 0.5.11 with builtin python 2.5 support
Michael Thomas 4619126
- Updated selinux policy
Michael Thomas 4619126
Michael Thomas b885aa9
* Thu Dec 14 2006 Wart <wart at kobold.org> 0.5.10-4
Michael Thomas b885aa9
- Patch and rebuild for python 2.5
Michael Thomas b885aa9
Michael Thomas 75c10a4
* Wed Dec 6 2006 Wart <wart at kobold.org> 0.5.10-3
Michael Thomas 75c10a4
- Rebuild for new postgresql
Michael Thomas 75c10a4
Michael Thomas e7dc01e
* Fri Dec 1 2006 Wart <wart at kobold.org> 0.5.10-2
Michael Thomas e7dc01e
- Rebuild for new readline-devel
Michael Thomas e7dc01e
Michael Thomas e7dc01e
* Fri Oct 20 2006 Wart <wart at kobold.org> 0.5.10-1
Michael Thomas e7dc01e
- Update to 0.5.10
Michael Thomas e7dc01e
Michael Thomas 6a90090
* Mon Aug 28 2006 Wart <wart at kobold.org> 0.5.9-2
Michael Thomas 6a90090
- Use more globs in %%files section
Michael Thomas 6a90090
- Remove unused -devel subpackage declaration
Michael Thomas 6a90090
Michael Thomas 6a90090
* Sat Aug 26 2006 Wart <wart at kobold.org> 0.5.9-1
Michael Thomas 6a90090
- Update to 0.5.9
Michael Thomas 6a90090
Michael Thomas 6a90090
* Sat Aug 5 2006 Wart <wart at kobold.org> 0.5.8-5
Michael Thomas 6a90090
- Move semanage calls to the init script so that we can be sure they are
Michael Thomas 6a90090
  called if a system manager turns selinux on or off between installing
Michael Thomas 6a90090
  the package and starting it.
Michael Thomas 6a90090
- Remove FC4 bits from the spec file
Michael Thomas 6a90090
- unghost the .pyo files per the recent packaging committee decision
Michael Thomas 6a90090
- Don't bother explicitly creating a group for the cyphesis user
Michael Thomas 6a90090
Michael Thomas 6a90090
* Thu Aug 3 2006 Wart <wart at kobold.org> 0.5.8-4
Michael Thomas 6a90090
- Use find+sed in %%install instead of enumerating directories in %%files
Michael Thomas 6a90090
- Remove the use of fedora-usermgmt.  There's no need.
Michael Thomas 6a90090
Michael Thomas 6a90090
* Tue Aug 1 2006 Wart <wart at kobold.org> 0.5.8-3
Michael Thomas 6a90090
- Clean up %%files
Michael Thomas 6a90090
Michael Thomas 6a90090
* Tue Aug 1 2006 Wart <wart at kobold.org> 0.5.8-2
Michael Thomas 6a90090
- Fix -init patch that was missing some key changes.
Michael Thomas 6a90090
Michael Thomas 6a90090
* Tue Aug 1 2006 Wart <wart at kobold.org> 0.5.8-1
Michael Thomas 6a90090
- Initial spec file for Fedora Extras