[jetrix-cvs] SF.net SVN: jetrix:[790] jetrix/trunk
Brought to you by:
smanux
From: <sm...@us...> - 2009-02-13 14:38:34
|
Revision: 790 http://jetrix.svn.sourceforge.net/jetrix/?rev=790&view=rev Author: smanux Date: 2009-02-13 14:38:29 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Daemonization for Debian Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/src/etc/deb/control/conffiles jetrix/trunk/src/etc/deb/control/postinst jetrix/trunk/src/etc/deb/control/postrm jetrix/trunk/src/etc/deb/control/preinst Added Paths: ----------- jetrix/trunk/src/etc/deb/ jetrix/trunk/src/etc/deb/control/ jetrix/trunk/src/etc/deb/control/prerm jetrix/trunk/src/etc/deb/data/ jetrix/trunk/src/etc/deb/data/etc/ jetrix/trunk/src/etc/deb/data/etc/default/ jetrix/trunk/src/etc/deb/data/etc/default/jetrix jetrix/trunk/src/etc/deb/data/etc/init.d/ jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix Removed Paths: ------------- jetrix/trunk/src/etc/control/ Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2009-02-13 14:30:13 UTC (rev 789) +++ jetrix/trunk/build.xml 2009-02-13 14:38:29 UTC (rev 790) @@ -253,7 +253,7 @@ <target name="dist.linux" depends="dist" description="Build the Linux installer"> <mkdir dir="${build}/control"/> <copy todir="${build}/control" filtering="true" > - <fileset dir="${src}/etc/control"/> + <fileset dir="src/etc/deb/control"/> </copy> <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask" classpath="lib/build/jdeb-0.7-SNAPSHOT.jar"/> @@ -262,7 +262,9 @@ <data src="${dist}/bin/jetrix-${version}.tar.bz2"> <mapper type="prefix" strip="1" prefix="/usr/share/jetrix"/> <exclude name="**/*.bat"/> + <exclude name="**/update"/> </data> + <fileset dir="src/etc/deb/data"/> </deb> </target> Modified: jetrix/trunk/src/etc/deb/control/conffiles =================================================================== --- jetrix/trunk/src/etc/control/conffiles 2009-02-12 16:11:42 UTC (rev 785) +++ jetrix/trunk/src/etc/deb/control/conffiles 2009-02-13 14:38:29 UTC (rev 790) @@ -1,2 +1,4 @@ +/etc/default/jetrix +/etc/init.d/jetrix /etc/jetrix/server.xml /etc/jetrix/channels.xml Modified: jetrix/trunk/src/etc/deb/control/postinst =================================================================== --- jetrix/trunk/src/etc/control/postinst 2009-02-12 16:11:42 UTC (rev 785) +++ jetrix/trunk/src/etc/deb/control/postinst 2009-02-13 14:38:29 UTC (rev 790) @@ -1,13 +1,56 @@ #!/bin/sh +# +# Post installation script for Jetrix +# +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + JETRIX_HOME="/usr/share/jetrix"; -ln -s $JETRIX_HOME/jetrix /usr/games/jetrix +# create the jetrix user running the daemon +adduser --quiet --system --no-create-home --disabled-password jetrix +# add a symbolic link in /usr/games +ln -s --force $JETRIX_HOME/jetrix /usr/games/jetrix + # move the conf directory to /etc/jetrix and create a symbolic link mv $JETRIX_HOME/conf /etc/jetrix ln -s /etc/jetrix $JETRIX_HOME/conf +chown -R jetrix:nogroup /etc/jetrix # move the log directory to /var/log/jetrix and create a symbolic link mv $JETRIX_HOME/log /var/log/jetrix ln -s /var/log/jetrix $JETRIX_HOME/log +chown -R jetrix:nogroup /var/log/jetrix + +# unpack the jar files in the lib directory +for FILENAME in $(find $JETRIX_HOME/lib -name "*.pack" -print) +do + echo "Unpacking $FILENAME ..." + FILEBASE=$(dirname $FILENAME)/$(basename $FILENAME .pack) + unpack200 -r $FILENAME $FILEBASE +done + +# start Jetrix and register it to start at the end of the boot sequence +if [ -x "/etc/init.d/jetrix" ]; then + update-rc.d jetrix defaults 95 >/dev/null + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d jetrix start || exit $? + else + /etc/init.d/jetrix start || exit $? + fi +fi + +exit 0 Modified: jetrix/trunk/src/etc/deb/control/postrm =================================================================== --- jetrix/trunk/src/etc/control/postrm 2009-02-12 16:11:42 UTC (rev 785) +++ jetrix/trunk/src/etc/deb/control/postrm 2009-02-13 14:38:29 UTC (rev 790) @@ -1,3 +1,54 @@ #!/bin/sh +# +# Post removal script for Jetrix +# -rm -f /usr/games/jetrix +set -e + +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <overwriter> +# <overwriter-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +case "$1" in + purge) + # remove the log files + rm -Rf /var/log/jetrix + + # remove the symbolic link in /usr/games + rm -f /usr/games/jetrix + + # remove the unpacked jars in the lib directory + rm /usr/share/jetrix/lib/*.jar + + # unregister Jetrix from the boot sequence + update-rc.d jetrix remove >/dev/null || exit $? + + # remove the jetrix user + if [ -x "$(command -v deluser)" ] ; then + if getent passwd|grep -q ^jetrix: ; then + deluser --quiet --system jetrix > /dev/null || true + fi + else + echo >&2 "not removing 'jetrix' system account because deluser command was not found." + fi + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +exit 0 Modified: jetrix/trunk/src/etc/deb/control/preinst =================================================================== --- jetrix/trunk/src/etc/control/preinst 2009-02-12 16:11:42 UTC (rev 785) +++ jetrix/trunk/src/etc/deb/control/preinst 2009-02-13 14:38:29 UTC (rev 790) @@ -1,5 +1,20 @@ #!/bin/sh +# +# Pre installation script for Jetrix +# +set -e + +# summary of how this script can be called: +# * <new-preinst> `install' +# * <new-preinst> `install' <old-version> +# * <new-preinst> `upgrade' <old-version> +# * <old-preinst> `abort-upgrade' <new-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + # Create the installation directory mkdir -p /usr/share/jetrix chmod a+w /usr/share/jetrix + +exit 0 Added: jetrix/trunk/src/etc/deb/control/prerm =================================================================== --- jetrix/trunk/src/etc/deb/control/prerm (rev 0) +++ jetrix/trunk/src/etc/deb/control/prerm 2009-02-13 14:38:29 UTC (rev 790) @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Pre removal script for Jetrix +# + +set -e + +# stop the server +if [ -x "/etc/init.d/jetrix" ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d jetrix stop || exit $? + else + /etc/init.d/jetrix stop || exit $? + fi +fi + +exit 0 Added: jetrix/trunk/src/etc/deb/data/etc/default/jetrix =================================================================== --- jetrix/trunk/src/etc/deb/data/etc/default/jetrix (rev 0) +++ jetrix/trunk/src/etc/deb/data/etc/default/jetrix 2009-02-13 14:38:29 UTC (rev 790) @@ -0,0 +1,5 @@ +# Defaults for jetrix initscript + +# Master system-wide jetrix switch. The initscript +# will not run if it is not set to yes. +RUN="yes" Added: jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix =================================================================== --- jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix (rev 0) +++ jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix 2009-02-13 14:38:29 UTC (rev 790) @@ -0,0 +1,85 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: tetrinet-server jetrix +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Init script for Jetrix +### END INIT INFO + + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=jetrix +DESC="Jetrix TetriNET Server" +DAEMON=/usr/share/jetrix/jetrix +USER=jetrix +GROUP=nogroup + +test -x $DAEMON || exit 0 + +CONF=/etc/jetrix/server.xml +DAEMON_OPTS="--conf $CONF" +RUN="no" + +# Include jetrix defaults if available +if [ -f /etc/default/$NAME ] ; then + . /etc/default/$NAME +fi + +. /lib/init/vars.sh +. /lib/lsb/init-functions + +case "$1" in + start) + if [ "$RUN" != "yes" ] ; then + log_warning_msg "Not starting $DESC $NAME, disabled via /etc/default/$NAME" + exit 0 + fi + + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + + start-stop-daemon --start --quiet --user $USER --chuid $USER:$GROUP --exec $DAEMON -- $DAEMON_OPTS + + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $USER + + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + + restart) + [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME" + + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $USER + + case "$?" in + 0|1) + start-stop-daemon --start --quiet --user $USER --chuid $USER:$GROUP --exec $DAEMON -- start $DAEMON_OPTS + + case "$?" in + 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + *) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + *) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + esac + ;; + + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2 + exit 3 + ;; +esac + +exit 0 Property changes on: jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix ___________________________________________________________________ Added: svn:executable + * Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |