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

Pablo Fischer pabl0-guest@haydn.debian.org
Sat, 10 Apr 2004 13:51:42 -0600


Author: pabl0-guest
Date: 2004-04-10 13:51:40 -0600 (Sat, 10 Apr 2004)
New Revision: 541

Modified:
   xsp-snapshot/trunk/debian/official/asp.net-examples.postinst
Log:
Updated. Now we don't care to restart, stop or whatever, we just add the 
configuration file host and call mono-{xsp|server}-update.conf script and it will
check the final md5sum and restart the server



Modified: xsp-snapshot/trunk/debian/official/asp.net-examples.postinst
===================================================================
--- xsp-snapshot/trunk/debian/official/asp.net-examples.postinst	2004-04-10 19:15:47 UTC (rev 540)
+++ xsp-snapshot/trunk/debian/official/asp.net-examples.postinst	2004-04-10 19:51:40 UTC (rev 541)
@@ -1,99 +1,33 @@
 #!/bin/sh -e
 
-aspnet_xspconfd="/etc/xsp/conf.d/asp.net"
-aspnet_xspconffile="$aspnet_xspconfd/10_aspnet-examples"
+package="aspnet-examples"
 
-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	
-	if [ "$xsp_ps" != "1" ]; then
-	    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?
-	monoserver_pid=`cat /var/run/mono-server`
-	monoserver_ps=`ps -p $monoserver_pid | wc -l`
- 	# Are there any process running by that pid?
-	if [ "$xsp_ps" != "1" ]; then
-	    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() {
+make_config_host() {
     echo "# This is the configuration file"
-    echo "# for the asp.net virtualhost"
+    echo "# for the $package virtualhost"
     echo "path = /usr/share/asp.net-demos/asp"
     echo "alias = /samples"
 }
 
+update() {
+   daemon="$1"
+   cfg_dir="$2"   
+   which mono-$daemon-update.conf || return 0
+   if [ -d "/etc/$cfg_dir" ]; then
+       #Create the config host dir
+       mkdir -p "$cfg_dir/conf.d/$package"
+       #Add the file
+       make_config_host > "$cfg_dir/conf.d/$package/10_$package"
+       #Update..
+       mono-$daemon-update.conf || true
+   fi
+}
+    
 
 case "$1" in
     configure)
-	if [ -x "`which mono-xsp-update.conf`" > /dev/null 2>&1 -a -d /etc/xsp ]; then
-	    mkdir -p $aspnet_xspconfd
-	    make_conffile > "$aspnet_xspconffile"		
-	    mono-xsp-update.conf
-	    restart_xsp
-	fi
-	if [ -x "`which mono-server-update.conf`" > /dev/null 2>&1 -a -d /etc/mono-server ]; then
-	    mkdir -p $aspnet_monoserverconfd
-	    make_conffile > "$aspnet_monoserverconffile"		
-	    mono-server-update.conf
-	    restart_monoserver
-	fi
+	update xsp xsp
+	update server mono-server
 	;;
     
     abort-upgrade|abort-remove|abort-deconfigure)