From 55d55cd7d00f044e1a5e1be634ac3c44a96b4efd099ce72e094838888d186b7e Mon Sep 17 00:00:00 2001 From: Dirk Stoecker Date: Mon, 25 Mar 2019 15:33:56 +0000 Subject: [PATCH] Accepting request 679282 from home:jmoellers:branches:games OBS-URL: https://build.opensuse.org/request/show/679282 OBS-URL: https://build.opensuse.org/package/show/games/bzflag?expand=0&rev=24 --- bzflag.changes | 9 +++++++++ bzflag.spec | 32 ++++++++++++++++++-------------- bzflagserver.service | 25 +++++++++++++++++++++++++ rc.bzflagserver | 4 ++-- 4 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 bzflagserver.service diff --git a/bzflag.changes b/bzflag.changes index 59d949d..bfe4ca4 100644 --- a/bzflag.changes +++ b/bzflag.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Feb 26 15:02:29 UTC 2019 - josef.moellers@suse.com + +- Replaced the sysv init script by a systemd unit file + Due to the complexity of the init script, the script is still + used to start/stop the server. Note that the init script + and the systemd unit file are not part of upstream! + [bsc#1115940, bzflagserver.service] + ------------------------------------------------------------------- Thu Dec 21 15:38:17 UTC 2017 - bwiedemann@suse.com diff --git a/bzflag.spec b/bzflag.spec index 68c0a2f..bd33a1e 100644 --- a/bzflag.spec +++ b/bzflag.spec @@ -1,7 +1,7 @@ # # spec file for package bzflag # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -28,13 +28,13 @@ Summary: 3D Networked Multiplayer Tank Battle Game License: GPL-2.0+ Group: Amusements/Games/3D/Shoot Url: http://bzflag.org/ -#Source: https://github.com/BZFlag-Dev/bzflag/archive/v%{version}.tar.gz#/bzflag-%{version}.tar.gz Source: https://download.bzflag.org/bzflag/source/%{version}/bzflag-%{version}.tar.gz Source2: rc.bzflagserver Source3: %{name}-maps.tar.bz2 Source4: sysconfig.bzflagserver-bzflag Source5: %{name}.desktop Source6: %{name}.png +Source7: bzflagserver.service # PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines Patch0: %{name}-1.10.4-ncursespollution.patch BuildRequires: bc @@ -56,7 +56,6 @@ BuildRequires: pkgconfig(glew) BuildRequires: zlib-devel %endif Requires(pre): %fillup_prereq -Requires(pre): %insserv_prereq BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -71,6 +70,7 @@ Find server maps in /usr/share/bzflag/maps. %setup -q -a 3 %patch0 -p1 cp %{SOURCE2} . +cp %{SOURCE7} . %build %configure \ @@ -79,25 +79,28 @@ cp %{SOURCE2} . --disable-static make %{?_smp_mflags} all +%pre +%service_add_pre bzflagserver.service + %preun -%stop_on_removal bzflagserver +%service_del_preun bzflagserver.service %post %fillup_only -an bzflagserver +%service_add_post bzflagserver.service %postun -%restart_on_update bzflagserver -%insserv_cleanup +%service_del_postun bzflagserver.service %install #Init script for the BZFlag server -install -D -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/bzflagserver -mkdir -p %{buildroot}%{_sbindir} -ln -s %{_sysconfdir}/init.d/bzflagserver %{buildroot}%{_sbindir}/rcbzflagserver +mkdir -p %{buildroot}%{_datadir}/%{name}/scripts +install -D -m 755 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/scripts/rcbzflagserver +install -D -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/bzflagserver.service make MKDIR_P="mkdir -p --" DESTDIR=%{buildroot} install install -D -m 644 %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.bzflagserver-bzflag -mkdir -p %{buildroot}%{_datadir}/bzflag/maps -install -m 644 maps/*bzmap %{buildroot}%{_datadir}/bzflag/maps +mkdir -p %{buildroot}%{_datadir}/%{name}/maps +install -m 644 maps/*bzmap %{buildroot}%{_datadir}/%{name}/maps install -D -m 644 %{SOURCE6} %{buildroot}%{_datadir}/pixmaps/bzflag.png %suse_update_desktop_file -i %{name} %fdupes %{buildroot} @@ -106,10 +109,11 @@ install -D -m 644 %{SOURCE6} %{buildroot}%{_datadir}/pixmaps/bzflag.png %defattr(-, root, root) %doc AUTHORS COPYING PORTING README DEVINFO %doc README.Linux misc/bzfs.conf ChangeLog -%{_sysconfdir}/init.d/bzflagserver -%{_sbindir}/rcbzflagserver -%{_bindir}/* %{_datadir}/%{name}/ +%{_datadir}/%{name}/scripts/ +%{_datadir}/bzflag/scripts/rcbzflagserver +%{_unitdir}/bzflagserver.service +%{_bindir}/* %{_datadir}/applications/%{name}.desktop %{_datadir}/pixmaps/%{name}.png %{_mandir}/man5/* diff --git a/bzflagserver.service b/bzflagserver.service new file mode 100644 index 0000000..8e14175 --- /dev/null +++ b/bzflagserver.service @@ -0,0 +1,25 @@ +# Automatically generated by systemd-sysv-generator + +[Unit] +Documentation=http://bzflag.org/ +SourcePath=/usr/share/bzflag/scripts/rcbzflagserver +Description=LSB: bzflag server daemon +After=remote-fs.target +Wants=remote-fs.target +Wants=syslog.socket + +[Service] +Type=forking +Restart=no +TimeoutSec=5min +IgnoreSIGPIPE=no +KillMode=process +GuessMainPID=no +RemainAfterExit=yes +SuccessExitStatus=5 6 +ExecStart=/usr/share/bzflag/scripts/rcbzflagserver start +ExecStop=/usr/share/bzflag/scripts/rcbzflagserver stop +ExecReload=/usr/share/bzflag/scripts/rcbzflagserver reload + +[Install] +WantedBy=multi-user.target diff --git a/rc.bzflagserver b/rc.bzflagserver index 5933e73..69f9613 100644 --- a/rc.bzflagserver +++ b/rc.bzflagserver @@ -62,12 +62,12 @@ case "$1" in if [ "$BZFLAGSERVER_SRVMSG" ] ; then startproc -u nobody -g nobody $BZFLAGSERVER_BIN \ $BZFLAGSERVER_OPTS $PUBLIC -p "$BZFLAGSERVER_PORT" \ - -world "/usr/share/games/bzflag/maps/$BZFLAGSERVER_WORLD" \ + -world "/usr/share/bzflag/maps/$BZFLAGSERVER_WORLD" \ -srvmsg "$BZFLAGSERVER_SRVMSG" $HANDICAP else startproc -u nobody -g nobody $BZFLAGSERVER_BIN \ $BZFLAGSERVER_OPTS $PUBLIC -p "$BZFLAGSERVER_PORT" \ - -world "/usr/share/games/bzflag/maps/$BZFLAGSERVER_WORLD" \ + -world "/usr/share/bzflag/maps/$BZFLAGSERVER_WORLD" \ $HANDICAP fi # Remember status and be verbose