[Pkg-mono-svn-commits] rev 527 - xsp-snapshot/trunk/debian/official

Pablo Fischer pabl0-guest@haydn.debian.org
Fri, 09 Apr 2004 16:58:55 -0600


Author: pabl0-guest
Date: 2004-04-09 16:58:52 -0600 (Fri, 09 Apr 2004)
New Revision: 527

Modified:
   xsp-snapshot/trunk/debian/official/asp.net-examples.postinst
   xsp-snapshot/trunk/debian/official/asp.net-examples.prerm
Log:
Also reedited. The postinst is more clean and now detects if 
asp.net-examples package is the first package for xsp or mono-server, 
if it is, it starts mono-xsp or mono-server.

The prerm removes the asp.net conf dir



Modified: xsp-snapshot/trunk/debian/official/asp.net-examples.postinst
===================================================================
--- xsp-snapshot/trunk/debian/official/asp.net-examples.postinst	2004-04-09 22:55:21 UTC (rev 526)
+++ xsp-snapshot/trunk/debian/official/asp.net-examples.postinst	2004-04-09 22:58:52 UTC (rev 527)
@@ -6,21 +6,48 @@
 aspnet_monoserverconfd="/etc/mono-server/conf.d/asp.net"
 aspnet_monoserverconffile="$aspnet_monoserverconfd/10_aspnet-examples"
 
+monoserver_default="/etc/default/mono-server"
+monoxsp_default="/etc/default/mono-xsp"
 
+restart_firsttime() {    
+    confd="$1"
+    daemon="$2"
+    desc="$3"
+    almost_empty="`ls -lA $confd | wc -l`"
+    if [ "$almost_empty" = "2" ] ; then
+	echo "Starting $desc: $daemon"
+	/etc/init.d/$daemon start > /dev/null 2>&1 || true		
+    fi    
+}
+
+
 restart_xsp() {
+    #Ok, include the default file
+    . $monoxsp_default
     #XSP is running?
     if [ -f /var/run/mono-xsp ]; then
         # Are we really running xsp?
 	xsp_pid=`cat /var/run/mono-xsp`
 	xsp_ps=`ps -p $xsp_pid | wc -l`
- 	# Are there any process running by that pid?
+ 	# Are there any process running by that pid	
 	if [ "$xsp_ps" != "1" ]; then
-	    /etc/init.d/mono-xsp restart
+	    if [ "$start_boot" = "true" ]; then
+		echo "Restarting XSP WebServer: mono-xsp"
+		/etc/init.d/mono-xsp restart > /dev/null 2>&1 || true
+	    fi
+	else
+	    restart_firsttime "/etc/xsp/conf.d" "mono-xsp" "XSP WebServer"
 	fi
+    else
+	if [ "$start_boot" = "true" ]; then
+	    restart_firsttime "/etc/xsp/conf.d" "mono-xsp" "XSP WebServer"
+	fi
     fi
 }
 
 restart_monoserver() {
+    #Ok, include the default file
+    . $monoserver_default
     #MonoServer is running?
     if [ -f /var/run/mono-server ]; then
         # Are we really running xsp?
@@ -28,11 +55,23 @@
 	monoserver_ps=`ps -p $monoserver_pid | wc -l`
  	# Are there any process running by that pid?
 	if [ "$xsp_ps" != "1" ]; then
-	    /etc/init.d/mono-server restart
+	    if [ "$start_boot" = "true" ]; then
+		echo "Restarting Mono Server: mod-mono-server"
+		/etc/init.d/mono-server restart > /dev/null 2>&1 || true
+	    fi
+	else
+	    restart_firsttime "/etc/mono-server/conf.d" "mono-server" "Mono Server"
 	fi
+    else
+	if [ "$start_boot" = "true" ]; then
+	    restart_firsttime "/etc/mono-server/conf.d" "mono-server" "Mono Server"
+	fi
     fi
+	
+
 }
 
+
 make_conffile() {
     echo "# This is the configuration file"
     echo "# for the asp.net virtualhost"
@@ -43,58 +82,18 @@
 
 case "$1" in
     configure)
-	if [ -x /usr/share/dotnet/bin/xsp.exe -a -d /etc/xsp ]; then
-            #Ok, we have the asp.net conf directory?
-	    if [ -d $aspnet_xspconfd ]; then
-		# Ok, we have these files?
-		if [ -f $aspnet_xspconffile ]; then
-		    # Ok, different checksum?
-		    checksum=`md5sum $aspnet_xspconffile | awk '{print $1}'`
-		    if [ $checksum != "b1aad45b5d1ba55edb114d33ccbfb751" ]; then
-			echo "Updating Root Servers..."
-			make_conffile > "$aspnet_xspconffile"		
-		    fi
-		else
-		    echo "Updating Root Servers..."
-		    make_conffile > "$aspnet_xspconffile"		
-		fi
-	    else
-		mkdir -p $aspnet_xspconfd
-		echo "Updating Root Servers..."
-		make_conffile > "$aspnet_xspconffile"		
-	    fi
-	    #Update the BIG file.. mm.. Big Fish :)
+	if [ -x "`which mono-xsp-update.conf`" 2>/dev/null -a -d /etc/xsp ]; then
+	    mkdir -p $aspnet_xspconfd
+	    make_conffile > "$aspnet_xspconffile"		
 	    mono-xsp-update.conf
-	    #Restart XSP
 	    restart_xsp
 	fi
-
-	if [ -x /usr/share/dotnet/bin/mod-mono-server.exe -a -d /etc/mono-server ]; then
-            #Ok, we have the asp.net conf directory?
-	    if [ -d $aspnet_monoserverconfd ]; then
-		# Ok, we have these files?
-		if [ -f $aspnet_monoserverconffile ]; then
-		    # Ok, different checksum?
-		    checksum=`md5sum $aspnet_monoserverconffile | awk '{print $1}'`
-		    if [ $checksum != "b1aad45b5d1ba55edb114d33ccbfb751" ]; then
-			echo "Updating Root Servers..."
-			make_conffile > "$aspnet_monoserverconffile"		
-		    fi
-		else
-		    echo "Updating Root Servers..."
-		    make_conffile > "$aspnet_monoserverconffile"		
-		fi
-	    else
-		mkdir -p $aspnet_monoserverconfd
-		echo "Updating Root Servers..."
-		make_conffile > "$aspnet_monoserverconffile"		
-	    fi
-	    #Update the BIG File.. 
+	if [ -x "`which /usr/share/dotnet/bin/mod-mono-server.exe`" 2>/dev/null -a -d /etc/mono-server ]; then
+	    mkdir -p $aspnet_monoserverconfd
+	    make_conffile > "$aspnet_monoserverconffile"		
 	    mono-server-update.conf
-	    #Restart MonoServer
 	    restart_monoserver
 	fi
-
 	;;
     
     abort-upgrade|abort-remove|abort-deconfigure)

Modified: xsp-snapshot/trunk/debian/official/asp.net-examples.prerm
===================================================================
--- xsp-snapshot/trunk/debian/official/asp.net-examples.prerm	2004-04-09 22:55:21 UTC (rev 526)
+++ xsp-snapshot/trunk/debian/official/asp.net-examples.prerm	2004-04-09 22:58:52 UTC (rev 527)
@@ -3,6 +3,9 @@
 aspnet_xspconfd="/etc/xsp/conf.d/asp.net"
 aspnet_monoserverconfd="/etc/mono-server/conf.d/asp.net"
 
+monoserver_default="/etc/default/mono-server"
+monoxsp_default="/etc/default/mono-xsp"
+
 restart_xsp() {
     #XSP is running?
     if [ -f /var/run/mono-xsp ]; then
@@ -11,7 +14,12 @@
 	xsp_ps=`ps -p $xsp_pid | wc -l`
  	# Are there any process running by that pid?
 	if [ "$xsp_ps" != "1" ]; then
-	    /etc/init.d/mono-xsp restart
+	    #Include default
+	    . $monoxsp_default
+	    if [ "$start_boot" = "true" ]; then
+		echo "Restarting XSP WebServer: mono-xsp"
+		/etc/init.d/mono-xsp restart > /dev/null 2>&1 || true
+	    fi
 	fi
     fi
 }
@@ -24,25 +32,26 @@
 	monoserver_ps=`ps -p $monoserver_pid | wc -l`
  	# Are there any process running by that pid?
 	if [ "$xsp_ps" != "1" ]; then
-	    /etc/init.d/mono-server restart
+	    #Include default (monoserver)
+	    . $monoserver_default
+	    if [ "$start_boot" = "true" ]; then
+		echo "Restarting Mono Server: mod-mono-server"
+		/etc/init.d/mono-server restart > /dev/null 2>&1 || true
+	    fi
 	fi
     fi
 }
 
 case "$1" in
     remove)
-	if [ -x /usr/share/dotnet/bin/xsp.exe -a -d /etc/xsp ]; then
-            #We should remove everything... 
+	if [ -x "`which mono-xsp-update.conf`" 2>/dev/null -a -d /etc/xsp ]; then
 	    rm -Rf $aspnet_xspconfd
 	    mono-xsp-update.conf
-	    #Restart XSP
 	    restart_xsp
 	fi
-
-	if [ -x /usr/share/dotnet/bin/mod-mono-server.exe -a -d /etc/mono-server ]; then
+	if [ -x "`which /usr/share/dotnet/bin/mod-mono-server.exe`" 2>/dev/null -a -d /etc/mono-server ]; then
 	    rm -Rf $aspnet_monoserverconfd
 	    mono-server-update.conf
-	    #Restart mono-server
 	    restart_monoserver
 	fi
 	;;