commit e44c1e0c0943daac5b3953f6ff0fccab21895156
Author: Jon Ciesla <limburgher(a)gmail.com>
Date: Tue Jan 31 15:11:06 2012 -0600
systemd, python modules.
wesnoth.spec | 70 ++++++++++++++++++++++++++++++++++++++++++++---------
wesnothd.service | 12 +++++++++
2 files changed, 70 insertions(+), 12 deletions(-)
---
diff --git a/wesnoth.spec b/wesnoth.spec
index 854e143..ff5ef38 100644
--- a/wesnoth.spec
+++ b/wesnoth.spec
@@ -1,13 +1,15 @@
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+
Name: wesnoth
Version: 1.10
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Turn-based strategy game with a fantasy theme
Group: Amusements/Games
License: GPLv2+
URL:
http://www.wesnoth.org
Source0:
http://www.%{name}.org/files/%{name}-%{version}.tar.bz2
-Source1: wesnothd.init
+Source1: wesnothd.service
Source2: %{name}.sysconfig
Patch0: %{name}-1.2.8-gcc43.patch
#Patch1: wesnoth-1.5.11-remove-ogg-test.patch
@@ -59,9 +61,13 @@ friends--or strangers--and fight multi-player epic fantasy battles.
Summary: %{summary}
Group: Amusements/Games
Requires: %{name} = %{version}-%{release}
-Requires(post): /sbin/chkconfig
-Requires(preun):/sbin/chkconfig
+#Requires(post): /sbin/chkconfig
+#Requires(preun):/sbin/chkconfig
Requires(pre): /usr/sbin/useradd
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
%description server
@@ -140,6 +146,10 @@ popd
#%ifarch noarch
### Data Files and Desktop Files
#make install-data DESTDIR=${RPM_BUILD_ROOT}
+#Python modules for tools
+mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
+mv data/tools/wesnoth $RPM_BUILD_ROOT%{python_sitelib}
+
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/wesnoth
for i in data fonts icons images sounds; do
cp -pr $i $RPM_BUILD_ROOT/%{_datadir}/wesnoth/
@@ -208,7 +218,7 @@ mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}/var/run/wesnothd
touch ${RPM_BUILD_ROOT}/var/run/wesnothd/socket
install -Dpm 755 %{SOURCE1} \
- $RPM_BUILD_ROOT%{_initrddir}/wesnothd
+ $RPM_BUILD_ROOT%{_unitdir}/wesnothd.service
install -Dpm 644 %{SOURCE2} \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/wesnoth
@@ -252,19 +262,49 @@ fi
%post server
-/sbin/chkconfig --add wesnothd
-if [ $1 -gt 1 ]; then
- %{_initrddir}/wesnothd try-restart >/dev/null || :
+#/sbin/chkconfig --add wesnothd
+#if [ $1 -gt 1 ]; then
+# %%{_initrddir}/wesnothd try-restart >/dev/null || :
+#fi
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
+
%preun server
-if [ $1 -eq 0 ]; then
- %{_initrddir}/wesnothd stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del wesnothd
+#if [ $1 -eq 0 ]; then
+# %%{_initrddir}/wesnothd stop >/dev/null 2>&1 || :
+# /sbin/chkconfig --del wesnothd
+#fi
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable wesnothd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop wesnothd.service > /dev/null 2>&1 || :
fi
+
+%postun server
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart wesnothd.service >/dev/null 2>&1 || :
+fi
+
+
#%endif
+%triggerun -- wesnoth-server < 1.10-2
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply wesnothd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save wesnothd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del wesnothd >/dev/null 2>&1 || :
+/bin/systemctl try-restart wesnothd.service >/dev/null 2>&1 || :
+
+
#%ifnarch noarch
%files
%defattr(-,root,root,-)
@@ -282,7 +322,8 @@ fi
%files server
%defattr(-,root,root,-)
-%config %{_initrddir}/wesnothd
+#%%config %%{_initrddir}/wesnothd
+%{_unitdir}/wesnothd.service
%config(noreplace) %{_sysconfdir}/sysconfig/wesnoth
%{_sbindir}/wesnothd
%attr(0700,wesnothd,wesnothd) %dir /var/run/wesnothd/
@@ -297,10 +338,15 @@ fi
%{_datadir}/pixmaps/*
%{_datadir}/fonts/*
%{_mandir}/*
+%{python_sitelib}/wesnoth
#%endif
%changelog
+* Tue Jan 31 2012 Jon Ciesla <limburgher(a)gmail.com> - 1.10-2
+- Migrate to systemd, BZ 661241.
+- Placed python modules.
+
* Sun Jan 29 2012 Jon Ciesla <limburgher(a)gmail.com> - 1.10-1
- New upstream, 1.10 final.
diff --git a/wesnothd.service b/wesnothd.service
new file mode 100644
index 0000000..e6bb9a2
--- /dev/null
+++ b/wesnothd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Wesnoth game server
+After=network.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/wesnoth
+Type=forking
+User=wesnothd
+ExecStart=/usr/sbin/wesnothd --daemon $WESNOTHD_OPTIONS
+
+[Install]
+WantedBy=multi-user.target