rpms/xpilot-ng/devel xpilot-ng-server.init, NONE, 1.1 xpilot-ng.logrotate, NONE, 1.1 xpilot-ng.sysconfig, NONE, 1.1 xpilot-ng.spec, 1.2, 1.3

Michael Thomas (wart) fedora-extras-commits at redhat.com
Wed Mar 1 04:46:10 UTC 2006


Author: wart

Update of /cvs/extras/rpms/xpilot-ng/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24858

Modified Files:
	xpilot-ng.spec 
Added Files:
	xpilot-ng-server.init xpilot-ng.logrotate xpilot-ng.sysconfig 
Log Message:
Add init startup script with associated support files (logrotate, sysconfig)
Add RPM_OPT_FLAGS to compile line
More readable spacing in changelog




--- NEW FILE xpilot-ng-server.init ---
#!/bin/sh
#
# xpilot-ng-server     This shell script takes care of starting and stopping
#              the xpilot-ng game server.
#
# chkconfig:   - 15 85
# description: The xpilot-ng server supports playing networked \
#              multi-player games.
# processname: xpilot-ng-server
# config:      /etc/sysconfig/xpilot-ng-server
# pidfile:     /var/run/xpilot-ng-server.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

exec="/usr/bin/xpilot-ng-server"
prog=$(basename $exec)
pidfile=/var/run/$prog.pid

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/$prog

start() {
    echo -n $"Starting Xpilot game server: "
    if [ -n "`/sbin/pidof $prog`" ]; then
        echo -n $"$prog already running"
        failure
        echo
        return 1
    fi
    # This doesn't properly detect startup failures
    daemon --user games $exec $XPILOTD_OPTIONS >>/var/log/xpilot.log 2>&1 &
    retval=$?
    if [ $retval -eq 0 ]; then
        success
        touch $lockfile
        pidofproc $prog > $pidfile
    else
        failure
    fi
    echo
    return $retval
}

stop() {
    echo -n $"Stopping Xpilot game server: "
    killproc $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

reload() {
    restart
}

force_reload() {
    restart
}

fdr_status() {
    status $prog
}

case "$1" in
    start|stop|restart|reload)
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        fdr_status
        ;;
    condrestart|try-restart)
        [ ! -f $lockfile ] || restart
    ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
        exit 2
esac


--- NEW FILE xpilot-ng.logrotate ---
/var/log/xpilotd.log {
    copytruncate
    notifempty
    missingok
    endscript
}


--- NEW FILE xpilot-ng.sysconfig ---
#
# xpilot-ng-server(6) options. Pick a custom port here if needed, for example.
#

# This option activates a public server.  This will advertise your
# xpilot server to the public xpilot metadirectory and keep xpilot
# running continuosly.
# The following two lines have the same effect:
#XPILOTD_OPTIONS="-expand PublicSettings"
#XPILOTD_OPTIONS="-idleRun -noQuit +reportToMetaServer"


# Normally xpilot will look in /usr/share/xpilot-ng for the
# configuration files.  This is fine for user-initiated servers.
# But for the system xpilot server we want to allow a different set
# of defaults.
XPILOTD_OPTIONS="-noQuit \
        -defaultsFileName /etc/xpilot-ng/defaults.txt \
        -passwordFileName /etc/xpilot-ng/password.txt"


Index: xpilot-ng.spec
===================================================================
RCS file: /cvs/extras/rpms/xpilot-ng/devel/xpilot-ng.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xpilot-ng.spec	21 Feb 2006 20:17:24 -0000	1.2
+++ xpilot-ng.spec	1 Mar 2006 04:46:09 -0000	1.3
@@ -1,6 +1,6 @@
 Name:           xpilot-ng
 Version:        4.7.2
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Multiplayer space arcade game
 
 Group:          Amusements/Games
@@ -10,12 +10,19 @@
 Source1:	xpilot-ng.png
 Source2:	xpilot-ng-x11.desktop
 Source3:	xpilot-ng-sdl.desktop
+Source4:	xpilot-ng-server.init
+Source5:        xpilot-ng.sysconfig
+Source6:        xpilot-ng.logrotate
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  desktop-file-utils
 BuildRequires:  expat-devel SDL_ttf-devel SDL_image-devel zlib-devel
 # The following BR are not needed for FC-4
 BuildRequires:  libXt-devel mesa-libGLU-devel libXxf86misc-devel
+Requires(post): /sbin/chkconfig
+Requires(post): /sbin/service
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
 
 %description
 A highly addictive, infinitely configurable multiplayer space
@@ -43,7 +50,7 @@
 
 
 %build
-%configure
+CFLAGS="$RPM_OPT_FLAGS" %configure
 make %{?_smp_mflags}
 
 
@@ -64,6 +71,19 @@
 mkdir -p $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/
 install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/
 
+install -p -D -m 755 %{SOURCE4} $RPM_BUILD_ROOT/%{_initrddir}/%{name}-server
+
+install -p -D -m 644 %{SOURCE5} \
+    $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/%{name}-server
+
+install -p -D -m 644 %{SOURCE6} \
+    $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/%{name}-server
+
+# Copy certain configuration files to /etc so that they can be properly managed
+# as config files.
+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
+
 %post
 touch --no-create %{_datadir}/icons/hicolor || :
 if [ -x %{_bindir}/gtk-update-icon-cache ]; then
@@ -76,6 +96,20 @@
    %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
 fi
 
+%post server
+/sbin/chkconfig --add xpilot-ng-server
+
+%preun server
+if [ "$1" = "0" ]; then
+    /sbin/service xpilot-ng-server stop > /dev/null 2>&1
+    /sbin/chkconfig --del xpilot-ng-server
+fi
+
+%postun server
+if [ "$1" -ge "1" ]; then
+    /sbin/service xpilot-ng-server restart >/dev/null 2>&1
+fi
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -99,6 +133,9 @@
 %defattr(-,root,root,-)
 %{_bindir}/xpilot-ng-xp-mapedit
 %{_bindir}/xpilot-ng-server
+%{_initrddir}/xpilot-ng-server
+%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-server
+%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-server
 %dir %{_datadir}/%{name}
 %{_datadir}/%{name}/defaults.txt
 %{_datadir}/%{name}/password.txt
@@ -106,6 +143,9 @@
 %{_datadir}/%{name}/shipshapes.txt
 %{_datadir}/%{name}/mapconvert.py
 %{_datadir}/%{name}/maps
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %attr(0600,games,games) %{_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
 %doc README COPYING
@@ -114,17 +154,28 @@
 %ghost %{_datadir}/%{name}/mapconvert.pyo
 
 %changelog
+* Tue Feb 28 2006 Wart <wart at kobold.org> 4.7.2-6
+- Added sysconfig and initrd files for starting xpilot server at boot time
+- Add copies of customizable configuration files to /etc/xpilot
+- More readable spacing in changelog
+- Add missing ; in desktop file
+- Added RPM_OPT_FLAGS to compile line
+
 * Thu Feb 16 2006 Wart <wart at kobold.org> 4.7.2-5
 - Rebuild for FC-5
+
 * Mon Feb 6 2006 Wart <wart at kobold.org> 4.7.2-4
 - Don't make duplicates of the doc files for the subpackage.
 - Use version macro is source path
 - Preserve timestamps when installing icons.
+
 * Fri Feb 3 2006 Wart <wart at kobold.org> 4.7.2-3
 - Add readme and license files to the server subpackage
 - Set default file attributes for the server subpackage
+
 * Fri Feb 3 2006 Wart <wart at kobold.org> 4.7.2-2
 - Allow both packages to 0wn datadir/xpilot-ng
 - Clean up non-utf8 man pages 
+
 * Thu Feb 2 2006 Wart <wart at kobold.org> 4.7.2-1
 - Initial submission to Fedora Extras




More information about the fedora-extras-commits mailing list