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

Pablo Fischer pabl0-guest@haydn.debian.org
Fri, 21 May 2004 11:38:08 -0600


Author: pabl0-guest
Date: 2004-05-21 11:38:05 -0600 (Fri, 21 May 2004)
New Revision: 768

Modified:
   xsp/trunk/debian/mono-server-admin.conf
Log:
The admin script


Modified: xsp/trunk/debian/mono-server-admin.conf
===================================================================
--- xsp/trunk/debian/mono-server-admin.conf	2004-05-21 17:37:38 UTC (rev 767)
+++ xsp/trunk/debian/mono-server-admin.conf	2004-05-21 17:38:05 UTC (rev 768)
@@ -16,6 +16,8 @@
 my ($action, $app, $path);
 
 
+my $confd_directory = "/etc/mono-server/conf.d";
+
 if($#ARGV eq "2") {
 
     if($ARGV[0] eq "add") {
@@ -72,13 +74,38 @@
 $path = (split("=", $path))[1];
 $app  = (split("=", $app))[1];
 
-if($app ne "/") {
-    $app = "/$app";
+
+if ($app =~ /^\//) {
+    $app =~ s|/*||;
 }
 
-print $path,"\n";
-print $app,"\n";
+#path exists?
+if ( ! -d $path ) {
+    print "$path does not exists!\n";
+    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;
+}
+
+#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";
+
 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";