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

Pablo Fischer pabl0-guest@haydn.debian.org
Tue, 25 May 2004 09:47:38 -0600


Author: pabl0-guest
Date: 2004-05-25 09:47:35 -0600 (Tue, 25 May 2004)
New Revision: 827

Modified:
   xsp/trunk/debian/asp.net-examples.hostxsp
   xsp/trunk/debian/mono-server-admin.conf
   xsp/trunk/debian/mono-server-update.conf
Log:
Added a new feature to host files of mono-server.

the update script can understand the 'libs' and then 
replace it with the MonoPath.



Modified: xsp/trunk/debian/asp.net-examples.hostxsp
===================================================================
--- xsp/trunk/debian/asp.net-examples.hostxsp	2004-05-25 14:54:15 UTC (rev 826)
+++ xsp/trunk/debian/asp.net-examples.hostxsp	2004-05-25 15:47:35 UTC (rev 827)
@@ -2,3 +2,4 @@
 # for the aspnet-examples virtualhost
 path = /usr/share/asp.net-demos/asp
 alias = /samples
+libs = /usr/share/dotnet/lib

Modified: xsp/trunk/debian/mono-server-admin.conf
===================================================================
--- xsp/trunk/debian/mono-server-admin.conf	2004-05-25 14:54:15 UTC (rev 826)
+++ xsp/trunk/debian/mono-server-admin.conf	2004-05-25 15:47:35 UTC (rev 827)
@@ -13,12 +13,12 @@
 
 use strict;
 
-my ($action, $app, $path);
+my ($action, $app, $path, $libs);
 
 
 my $confd_directory = "/etc/mono-server/conf.d";
 
-if($#ARGV eq "2") {
+if($#ARGV ge "2") {
 
     if($ARGV[0] eq "add") {
 	$action = "add";
@@ -58,6 +58,19 @@
 	$path = $ARGV[2];
     }
     
+    
+    if($#ARGV eq "3") {
+	if($ARGV[1] =~ "--libs") {
+	    $libs = $ARGV[1];
+	}
+	elsif($ARGV[2] =~ "--libs") {
+	    $libs = $ARGV[2];
+	}
+	elsif($ARGV[3] =~ "--libs") {
+	    $libs = $ARGV[3];
+	}
+    }
+    
     else {
 	print "ERROR: Missing --path!\n";
 	&show_help;
@@ -85,6 +98,14 @@
     $app =~ s{/$}{}; 
 }
 
+#Remove the = stuff of libs
+$libs  = (split("=", $libs))[1];
+#Remove first :
+$libs =~ s|:*||;
+#and last : (dumb users)
+$app =~ s{:$}{}; 
+
+
 #path exists?
 if ( ! -d $path ) {
     print "$path does not exists!\n";
@@ -109,6 +130,7 @@
     print PACKAGEFILE "for the $app virtualhost\n";
     print PACKAGEFILE "path = $path\n";
     print PACKAGEFILE "alias = /$app\n";
+    print PACKAGEFILE "libs = $libs\n";
     close(PACKAGEFILE);
     
     system("/usr/sbin/mono-server-update.conf");

Modified: xsp/trunk/debian/mono-server-update.conf
===================================================================
--- xsp/trunk/debian/mono-server-update.conf	2004-05-25 14:54:15 UTC (rev 826)
+++ xsp/trunk/debian/mono-server-update.conf	2004-05-25 15:47:35 UTC (rev 827)
@@ -18,7 +18,7 @@
 #Main vars..
 my ($monoserver_dir, $monoserver_confd, $monoserver_hostfile, 
     $daemon, $daemon_pid, $default_file,
-    $applications);
+    $applications, $libs);
 
 #Setup main vars
 $monoserver_dir = "/etc/mono-server";
@@ -28,8 +28,8 @@
 $daemon_pid = "/var/run/apache.pid";
 $applications = "";
 $default_file = "/etc/default/mono-server";
+$libs = "/usr/share/dotnet/lib:/usr/lib";
 
-
 my $restart = "yes";
 my $first_file = "yes";
 my ($orig_md5, $new_md5);
@@ -50,8 +50,13 @@
 if(-f "$monoserver_hostfile.tmp") {
     #Prepare the application string
     $applications =~ s/,$//;
+    #and the libs..
+    $libs = "/usr/share/dotnet/lib:/usr/lib:$libs";
+    $libs =~ s/:$//;
     #sed the $monoserver_hostfile to replace the Applications
     &replace_applications;
+    #Replace the MONOPATH
+    &replace_monopath;
     #Close the file with a </Ifmodule> tag
     &writetempdefault_end;
     #cp the temp file to the original one..    
@@ -63,7 +68,7 @@
     #Equal?
     if(("$new_md5" ne "$orig_md5") && ($restart eq "yes")) {
 	if(( -f $daemon ) && ( -f $daemon_pid )) {
-	    system("$daemon restart");
+#	    system("$daemon restart");
 	}
     }
 }
@@ -145,13 +150,32 @@
     else {
 	$content =~ s/MonoApplications//gi;
     }
+    
+    open(TEMPHOST, "> $monoserver_hostfile.tmp");
+    print TEMPHOST $content;
+    close(TEMPHOST);
+}
 
+   
+sub replace_monopath {
+    local $/;
+
+    open(TEMPHOST, "$monoserver_hostfile.tmp");
+    my $content = <TEMPHOST>;
+    close(TEMPHOST);
+
+    if($libs) {
+	$content =~ s/MonoPath .*/MonoPath $libs/gi;
+    }
+    else {
+	$content =~ s/MonoPath//gi;
+    }
+    
     open(TEMPHOST, "> $monoserver_hostfile.tmp");
     print TEMPHOST $content;
     close(TEMPHOST);
 }
 
-   
 sub write_tempdefault_start {
     open(TEMPHOST, ">> $monoserver_hostfile.tmp");
 
@@ -161,7 +185,9 @@
     print TEMPHOST "  MonoServerPath /usr/share/dotnet/bin/mod-mono-server.exe\n";
     print TEMPHOST "  AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx\n";
     print TEMPHOST "  MonoApplications \n";
+    print TEMPHOST "  MonoPath \n";
 
+
     close(TEMPHOST);
     
 }
@@ -214,10 +240,21 @@
 	    #New lines..
 	    $alias =~ s/\n//;
 	}
+
+	if($line =~ /lib/i) {
+	    $libs = (split /\=/, $line)[1];
+	    #Blank spaces
+	    $libs =~ tr/\ //d;
+	    #New lines..
+	    $libs =~ s/\n//;
+	    #And remove the last and first ':'..
+	    $libs =~ s/:$//;
+        }    
     }	
     
     if($path) {
 	$applications = "$applications$alias:$path,";
+	$libs = "$libs:";
 
 	print TEMPHOST "# start $hostfile\n";
 	print TEMPHOST "     Alias $alias \"$path\"\n";