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

Pablo Fischer pabl0-guest@haydn.debian.org
Fri, 21 May 2004 14:37:19 -0600


Author: pabl0-guest
Date: 2004-05-21 14:37:17 -0600 (Fri, 21 May 2004)
New Revision: 778

Modified:
   xsp/trunk/debian/changelog
   xsp/trunk/debian/mono-server-admin.conf
   xsp/trunk/debian/mono-server-update.conf
   xsp/trunk/debian/mono-xsp-admin.conf
Log:
New pre release and fixed some bugs in the admin scripts (add/del actions)
also as the $applications problem (don't write to the file if it's empty)


Modified: xsp/trunk/debian/changelog
===================================================================
--- xsp/trunk/debian/changelog	2004-05-21 19:16:45 UTC (rev 777)
+++ xsp/trunk/debian/changelog	2004-05-21 20:37:17 UTC (rev 778)
@@ -1,3 +1,12 @@
+xsp (0.12-2) unstable; urgency=low
+
+  * Fixed the update script of mono-server, we should not create MonoApplication 
+    unless we have more than one directory in /etc/mono-server/conf.d and be valid
+  * Fixed a bug int he admin scripts, syntax error :-(
+  * Also added the two actions to the admin scripts: add and remove	
+	
+ -- Pablo Fischer <pablo@pablo.com.mx>  Fri, 20 May 2004 15:07:42 -0600	
+
 xsp (0.12-1) unstable; urgency=low
 
   * NEW Release!

Modified: xsp/trunk/debian/mono-server-admin.conf
===================================================================
--- xsp/trunk/debian/mono-server-admin.conf	2004-05-21 19:16:45 UTC (rev 777)
+++ xsp/trunk/debian/mono-server-admin.conf	2004-05-21 20:37:17 UTC (rev 778)
@@ -72,11 +72,17 @@
 }
 
 $path = (split("=", $path))[1];
+#Remove the last slash of the path
+$path =~ s{/$}{}; 
+
 $app  = (split("=", $app))[1];
 
 
 if ($app =~ /^\//) {
+    #Remove first slash
     $app =~ s|/*||;
+    #and last (dumb users)
+    $app =~ s{/$}{}; 
 }
 
 #path exists?
@@ -85,27 +91,38 @@
     exit;
 }
 
- 
-#But what if the conf.d package directory already exists?
-if ( -d "$confd_directory/$app") {
-    print "Sorry but $conf_directory/$app already exist, you might change your application name\n";
-    exit;
+#Add or remove?
+if($action eq "add") {
+    #But what if the conf.d package directory already exists?
+    if ( -d "$confd_directory/$app") {
+	print "Sorry but $confd_directory/$app already exist, you might change your application name\n";
+	exit;
+    }
+    
+    #Ok, create the conf.d package directory
+    system("mkdir $confd_directory/$app");
+    #And create the file
+    system("touch $confd_directory/$app/10_$app");
+    
+    open(PACKAGEFILE, "> $confd_directory/$app/10_$app");
+    print PACKAGEFILE "This is the configuration file \n";
+    print PACKAGEFILE "for the $app virtualhost\n";
+    print PACKAGEFILE "path = $path\n";
+    print PACKAGEFILE "alias = /$app\n";
+    close(PACKAGEFILE);
+    
+    system("/usr/sbin/mono-server-update.conf");
+    print "done!\n";
 }
 
-#Ok, create the conf.d package directory
-system("mkdir $confd_directory/$app");
-#And create the file
-system("touch $confd_directory/$app/10_$app");
-
-open(PACKAGEFILE, "> $confd_directory/$app/10_$app");
-print PACKAGEFILE "This is the configuration file \n";
-print PACKAGEFILE "for the $app virtualhost\n";
-print PACKAGEFILE "path = $path\n";
-print PACKAGEFILE "alias = /$app\n";
-close(PACKAGEFILE);
-
-print "done!\n";
-
+if($action eq "del") {
+    system("rm -Rf $confd_directory/$app");
+    system("/usr/sbin/mono-server-update.conf");
+    
+    print "done!\n";
+}
+    
+    
 sub show_help() {
     print "This script let the user to create a application host file in one step \n";
     print "for mono-server (/etc/mono-server/conf.d/application\n\n";

Modified: xsp/trunk/debian/mono-server-update.conf
===================================================================
--- xsp/trunk/debian/mono-server-update.conf	2004-05-21 19:16:45 UTC (rev 777)
+++ xsp/trunk/debian/mono-server-update.conf	2004-05-21 20:37:17 UTC (rev 778)
@@ -139,7 +139,12 @@
     my $content = <TEMPHOST>;
     close(TEMPHOST);
 
-    $content =~ s/MonoApplications .*/MonoApplications $applications/gi;
+    if($applications) {
+	$content =~ s/MonoApplications .*/MonoApplications $applications/gi;
+    }
+    else {
+	$content =~ s/MonoApplications//gi;
+    }
 
     open(TEMPHOST, "> $monoserver_hostfile.tmp");
     print TEMPHOST $content;
@@ -156,7 +161,6 @@
     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 "\n\n\n";
 
     close(TEMPHOST);
     
@@ -212,9 +216,9 @@
 	}
     }	
     
-    $applications = "$applications$alias:$path,";
-    
     if($path) {
+	$applications = "$applications$alias:$path,";
+
 	print TEMPHOST "# start $hostfile\n";
 	print TEMPHOST "     Alias $alias \"$path\"\n";
 	print TEMPHOST "       <Directory $path>\n";

Modified: xsp/trunk/debian/mono-xsp-admin.conf
===================================================================
--- xsp/trunk/debian/mono-xsp-admin.conf	2004-05-21 19:16:45 UTC (rev 777)
+++ xsp/trunk/debian/mono-xsp-admin.conf	2004-05-21 20:37:17 UTC (rev 778)
@@ -72,11 +72,18 @@
 }
 
 $path = (split("=", $path))[1];
+#Remove the last slash of the path
+$path =~ s{/$}{}; 
+
 $app  = (split("=", $app))[1];
 
 
 if ($app =~ /^\//) {
+    #Remove first slash
     $app =~ s|/*||;
+    #and last (dumb users)
+    $app =~ s{/$}{}; 
+
 }
 
 #path exists?
@@ -85,36 +92,48 @@
     exit;
 }
 
- 
-#But what if the conf.d package directory already exists?
-if ( -d "$confd_directory/$app") {
-    print "Sorry but $conf_directory/$app already exist, you might change your application name\n";
-    exit;
+ #Add or remove?
+if($action eq "add") {
+    #But what if the conf.d package directory already exists?
+    if ( -d "$confd_directory/$app") {
+	print "Sorry but $confd_directory/$app already exist, you might change your application name\n";
+	exit;
+    }
+    
+    #Ok, create the conf.d package directory
+    system("mkdir $confd_directory/$app");
+    #And create the file
+    system("touch $confd_directory/$app/10_$app");
+    
+    open(PACKAGEFILE, "> $confd_directory/$app/10_$app");
+    print PACKAGEFILE "This is the configuration file \n";
+    print PACKAGEFILE "for the $app virtualhost\n";
+    print PACKAGEFILE "path = $path\n";
+    print PACKAGEFILE "alias = /$app\n";
+    close(PACKAGEFILE);
+    
+    system("/usr/sbin/mono-xsp-update.conf");
+    print "done!\n";
 }
 
-#Ok, create the conf.d package directory
-system("mkdir $confd_directory/$app");
-#And create the file
-system("touch $confd_directory/$app/10_$app");
+if($action eq "del") {
+    system("rm -Rf $confd_directory/$app");
+    system("/usr/sbin/mono-xsp-update.conf");
+    
+    print "done!\n";
+}
 
-open(PACKAGEFILE, "> $confd_directory/$app/10_$app");
-print PACKAGEFILE "# This is the configuration file \n";
-print PACKAGEFILE "# for the $app virtualhost\n";
-print PACKAGEFILE "path = $path\n";
-print PACKAGEFILE "alias = /$app\n";
-close(PACKAGEFILE);
 
-print "done!\n";
 
 sub show_help() {
     print "This script let the user to create a application host file in one step \n";
-    print "for mono-server (/etc/mono-server/conf.d/application\n\n";
+    print "for XSP (/etc/xsp/conf.d/application\n\n";
     print "Use:\n";
-    print " mono-server-admin.conf [action] --path=/real/path --app=/applicationame\n\n";
+    print " mono-xsp-admin.conf [action] --path=/real/path --app=/applicationame\n\n";
     print "Where:\n";
     print " action:\n";
     print " add                   Creates an application\n";
-    print " del                   Delete an application (the directory /etc/mono-server/conf.d/application\n";
+    print " del                   Delete an application (the directory /etc/xsp/conf.d/application\n";
     print " --path=/real/path     A real and true path where you have your ASP.NET applicatio running\n";
-    print " --app=/application  The name of the application\n";
+    print " --app=/application    The name of the application\n";
 }