[Pkg-mono-svn-commits] rev 2627 - xsp/trunk/debian

D. Moonfire dmoonfire-guest at costa.debian.org
Fri Jul 14 01:31:44 UTC 2006


Author: dmoonfire-guest
Date: 2006-07-14 01:31:40 +0000 (Fri, 14 Jul 2006)
New Revision: 2627

Modified:
   xsp/trunk/debian/changelog
   xsp/trunk/debian/mono-xsp.init
   xsp/trunk/debian/mono-xsp.postinst
   xsp/trunk/debian/mono-xsp.preinst
   xsp/trunk/debian/mono-xsp.prerm
   xsp/trunk/debian/mono-xsp2.init
   xsp/trunk/debian/mono-xsp2.postinst
   xsp/trunk/debian/mono-xsp2.preinst
   xsp/trunk/debian/mono-xsp2.prerm
Log:
Changed the init scripts according to format in the rest of them.
Switched to the LSB functions in the init scripts, worked on
the various scripts to get them to use invoke-rc.d.


Modified: xsp/trunk/debian/changelog
===================================================================
--- xsp/trunk/debian/changelog	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/changelog	2006-07-14 01:31:40 UTC (rev 2627)
@@ -1,11 +1,15 @@
-xsp (1.1.15-1) unstable; urgency=low
+xsp (1.1.16-0pre1) unstable; urgency=low
 
   * New upstream release
   * Mirco 'meebey' Bauer
     + Added MONO_ABI_(INCOMP|COMP)_VERSION variable to debian/rules, because
       the compatible versions is not always equal to the XSP version.
+  * Dylan R. E. Moonfire
+    + Changed the init scripts to include the INIT SCRIPT INFO.
+    + Changed the postinit and prerm scripts to use invoke-rc.d. (Closes:
+      #367752, #367720)
 
- -- Debian Mono Group <pkg-mono-group at lists.alioth.debian.org>  Wed, 17 May 2006 20:32:00 +0200
+ -- Dylan R. E. Moonfire <debian at mfgames.com>  Thu, 13 Jul 2006 19:46:06 -0500
 
 xsp (1.1.13-1) unstable; urgency=low
 

Modified: xsp/trunk/debian/mono-xsp.init
===================================================================
--- xsp/trunk/debian/mono-xsp.init	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp.init	2006-07-14 01:31:40 UTC (rev 2627)
@@ -1,13 +1,24 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          mono-xsp
+# Required-Start:    
+# Required-Stop: 
+# Should-Start:      
+# Should-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Mono XSP
+# Description:       Debian init script for Mono XSP.
+### END INIT INFO
 #
-# mono-xsp Start the XSP WebServer, that works just for ASP.NET scripts.
+# Written by Pablo Fischer <pablo at pablo.com.mx>
+#            Dylan R. E. Moonfire <debian at mfgames.com>
+# Modified for Debian GNU/Linux
 #
-#		Written by Pablo Fischer <pablo at pablo.com.mx>.
-#		Modified for Debian GNU/Linux
-#
 # Version:	@(#)mono-xsp pablo at pablo.com.mx
 #
 
+# Variables
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/bin/xsp
 NAME=mono-xsp
@@ -17,13 +28,17 @@
 VIRTUALFILE=$CFGDIR/debian.webapp
 MONO_SHARED_DIR=/var/run/$NAME
 
+# Use LSB
+. /lib/lsb/init-functions
+
+# If we don't have the basics, don't bother
 test -x $DAEMON || exit 0
 test -f $DEFAULT && . $DEFAULT	
 
 should_start() {
     if [ ! -e $VIRTUALFILE -o `cat $VIRTUALFILE | wc -l` = "2" ]; then
-	echo "You have an incomplete $VIRTUALFILE"
-	echo "To fix it, you need to install at least one package for xsp (like asp.net-examples)"	
+	log_action_msg "You have an incomplete $VIRTUALFILE"
+	log_action_msg "To fix it, you need to install at least one package for xsp (like asp.net-examples)"	
 	return 1
     fi 
     
@@ -32,7 +47,7 @@
 	xsp_pid=`cat /var/run/$NAME.pid`
 	xsp_ps=`ps -p $xsp_pid | wc -l`
 	if [ "$xsp_ps" != "1" ]; then
-	    echo "Sorry, there is already a xsp running, stop it first"
+	    log_action_msg "Sorry, there is already a xsp running, stop it first"
 	    return 1		
 	fi
     fi
@@ -44,7 +59,7 @@
 case "$1" in
     start)
 	if should_start ; then
-	    echo -n "Starting $DESC: $NAME"
+	    log_daemon_msg "Starting $DESC" "$NAME"
 	    export MONO_SHARED_DIR
 	    start-stop-daemon --start --background --make-pidfile \
 		--quiet --pidfile /var/run/$NAME.pid \
@@ -52,17 +67,16 @@
 		--exec $DAEMON -- \
 		--port $port --address $address --appconfigdir \
 		$CFGDIR --nonstop
-	    echo "."
+	    log_end_msg $?
 	fi
 	;;
     stop)
-        echo -n "Stopping $DESC: $NAME"
+        log_daemon_msg "Stopping $DESC" "$NAME"
         for i in $(ps aux | grep -v grep | grep 'xsp.exe' | cut -c 10-15)
         do
                 kill $i >& /dev/null
-                echo -n " $i"
         done
-        echo "."
+	log_end_msg $?
 	;;
     restart|force-reload)
 	$0 stop

Modified: xsp/trunk/debian/mono-xsp.postinst
===================================================================
--- xsp/trunk/debian/mono-xsp.postinst	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp.postinst	2006-07-14 01:31:40 UTC (rev 2627)
@@ -83,11 +83,14 @@
 	mono-xsp-update
 	if [ "$RET" = "true" ]; then
 	    if should_start -a $autostart = "true" ; then
-		echo "Starting $DESC: $NAME "
-		/etc/init.d/mono-xsp start > /dev/null 2>&1 || true
+		if which invoke-rc.d >/dev/null 2>&1; then
+		    invoke-rc.d mono-xsp start
+		else
+		    /etc/init.d/mono-xsp start
+		fi
 	    fi
 	fi
-
+	    
 	rm -Rf $tempfile
 	;;
     

Modified: xsp/trunk/debian/mono-xsp.preinst
===================================================================
--- xsp/trunk/debian/mono-xsp.preinst	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp.preinst	2006-07-14 01:31:40 UTC (rev 2627)
@@ -3,26 +3,14 @@
 NAME=mono-xsp
 DESC="XSP WebServer"
 
-should_stop() {
-    if [ -f /var/run/$NAME.pid ]; then
-        # Are we really running xsp?
-	xsp_pid=`cat /var/run/$NAME.pid`
-	xsp_ps=`ps -p $xsp_pid | wc -l`
-	# Are there any process running by that pid?
-	if [ "$xsp_ps" = "2" ]; then
-	    return 0
-	else
-	    return 1
-	fi
-    fi
-    return 0
-}
-
 case "$1" in
-   upgrade|install)
-	if should_stop ; then
-	    echo -n "Stopping $DESC: $NAME "
-	    /etc/init.d/mono-xsp stop > /dev/null 2>&1 || true
+    upgrade|install)
+	if -f /etc/init.d/mono-xsp; then
+	    if which invoke-rc.d >/dev/null 2>&1; then
+		invoke-rc.d mono-xsp stop
+	    else
+		/etc/init.d/mono-xsp stop
+	    fi
 	fi
 	;;
 esac

Modified: xsp/trunk/debian/mono-xsp.prerm
===================================================================
--- xsp/trunk/debian/mono-xsp.prerm	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp.prerm	2006-07-14 01:31:40 UTC (rev 2627)
@@ -24,10 +24,13 @@
     remove)
 	# should we stop the server?
 	if should_stop ; then
-	    echo "Stopping $DESC: $NAME "
-	    /etc/init.d/mono-xsp stop > /dev/null 2>&1 || true
+	    if which invoke-rc.d >/dev/null 2>&1; then
+		invoke-rc.d mono-xsp stop
+	    else
+		/etc/init.d/mono-xsp stop
+	    fi
 	fi
-	    ;;
+	;;
     esac
 
 #DEBHELPER#

Modified: xsp/trunk/debian/mono-xsp2.init
===================================================================
--- xsp/trunk/debian/mono-xsp2.init	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp2.init	2006-07-14 01:31:40 UTC (rev 2627)
@@ -1,13 +1,24 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          mono-xsp2
+# Required-Start:    
+# Required-Stop: 
+# Should-Start:      
+# Should-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Mono XSP2
+# Description:       Debian init script for Mono XSP2.
+### END INIT INFO
 #
-# mono-xsp2 Start the XSP2 WebServer, that works just for ASP.NET scripts.
+# Written by Pablo Fischer <pablo at pablo.com.mx>
+#            Dylan R. E. Moonfire <debian at mfgames.com>
+# Modified for Debian GNU/Linux
 #
-#		Written by Pablo Fischer <pablo at pablo.com.mx>.
-#		Modified for Debian GNU/Linux
-#
 # Version:	@(#)mono-xsp2 pablo at pablo.com.mx
 #
 
+# Variables
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/bin/xsp2
 NAME=mono-xsp2
@@ -17,13 +28,17 @@
 VIRTUALFILE=$CFGDIR/debian.webapp
 MONO_SHARED_DIR=/var/run/$NAME
 
+# Use LSB
+. /lib/lsb/init-functions
+
+# If we don't have the basics, don't bother
 test -x $DAEMON || exit 0
 test -f $DEFAULT && . $DEFAULT	
 
 should_start() {
     if [ ! -e $VIRTUALFILE -o `cat $VIRTUALFILE | wc -l` = "2" ]; then
-	echo "You have an incomplete $VIRTUALFILE"
-	echo "To fix it, you need to install at least one package for xsp2 (like asp.net-examples)"	
+	log_action_msg "You have an incomplete $VIRTUALFILE"
+	log_action_msg "To fix it, you need to install at least one package for xsp2 (like asp.net-examples)"	
 	return 1
     fi 
     
@@ -32,7 +47,7 @@
 	xsp2_pid=`cat /var/run/$NAME.pid`
 	xsp2_ps=`ps -p $xsp2_pid | wc -l`
 	if [ "$xsp2_ps" != "1" ]; then
-	    echo "Sorry, there is already a xsp2 running, stop it first"
+	    log_action_msg "Sorry, there is already a xsp2 running, stop it first"
 	    return 1		
 	fi
     fi
@@ -44,7 +59,7 @@
 case "$1" in
     start)
 	if should_start ; then
-	    echo -n "Starting $DESC: $NAME"
+	    log_daemon_msg "Starting $DESC" "$NAME"
 	    export MONO_SHARED_DIR
 	    start-stop-daemon --start --background --make-pidfile \
 		--quiet --pidfile /var/run/$NAME.pid \
@@ -52,17 +67,16 @@
 		--exec $DAEMON -- \
 		--port $port --address $address --appconfigdir \
 		$CFGDIR --nonstop
-	    echo "."
+	    log_end_msg $?
 	fi
 	;;
     stop)
-        echo -n "Stopping $DESC: $NAME"
+	log_daemon_msg "Stopping $DESC" "$NAME"
         for i in $(ps aux | grep -v grep | grep 'xsp2.exe' | cut -c 10-15)
         do
                 kill $i >& /dev/null
-                echo -n " $i"
         done
-        echo "."
+	log_end_msg $?
 	;;
     restart|force-reload)
 	$0 stop

Modified: xsp/trunk/debian/mono-xsp2.postinst
===================================================================
--- xsp/trunk/debian/mono-xsp2.postinst	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp2.postinst	2006-07-14 01:31:40 UTC (rev 2627)
@@ -83,8 +83,11 @@
 	mono-xsp2-update
 	if [ "$RET" = "true" ]; then
 	    if should_start -a $autostart = "true" ; then
-		echo "Starting $DESC: $NAME "
-		/etc/init.d/mono-xsp2 start > /dev/null 2>&1 || true
+		if which invoke-rc.d >/dev/null 2>&1; then
+		    invoke-rc.d mono-xsp2 start
+		else
+		    /etc/init.d/mono-xsp2 start
+		fi
 	    fi
 	fi
 

Modified: xsp/trunk/debian/mono-xsp2.preinst
===================================================================
--- xsp/trunk/debian/mono-xsp2.preinst	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp2.preinst	2006-07-14 01:31:40 UTC (rev 2627)
@@ -3,26 +3,14 @@
 NAME=mono-xsp2
 DESC="XSP WebServer"
 
-should_stop() {
-    if [ -f /var/run/$NAME.pid ]; then
-        # Are we really running xsp2?
-	xsp2_pid=`cat /var/run/$NAME.pid`
-	xsp2_ps=`ps -p $xsp2_pid | wc -l`
-	# Are there any process running by that pid?
-	if [ "$xsp2_ps" = "2" ]; then
-	    return 0
-	else
-	    return 1
-	fi
-    fi
-    return 0
-}
-
 case "$1" in
    upgrade|install)
-	if should_stop ; then
-	    echo -n "Stopping $DESC: $NAME "
-	    /etc/init.d/mono-xsp2 stop > /dev/null 2>&1 || true
+	if -f /etc/init.d/mono-xsp; then
+	    if which invoke-rc.d >/dev/null 2>&1; then
+		invoke-rc.d mono-xsp2 stop
+	    else
+		/etc/init.d/mono-xsp2 stop
+	    fi
 	fi
 	;;
 esac

Modified: xsp/trunk/debian/mono-xsp2.prerm
===================================================================
--- xsp/trunk/debian/mono-xsp2.prerm	2006-07-13 19:09:14 UTC (rev 2626)
+++ xsp/trunk/debian/mono-xsp2.prerm	2006-07-14 01:31:40 UTC (rev 2627)
@@ -24,10 +24,13 @@
     remove)
 	# should we stop the server?
 	if should_stop ; then
-	    echo "Stopping $DESC: $NAME "
-	    /etc/init.d/mono-xsp2 stop > /dev/null 2>&1 || true
+	    if which invoke-rc.d >/dev/null 2>&1; then
+		invoke-rc.d mono-xsp2 stop
+	    else
+		/etc/init.d/mono-xsp2 stop
+	    fi
 	fi
-	    ;;
+	;;
     esac
 
 #DEBHELPER#




More information about the Pkg-mono-svn-commits mailing list