Update of /cvsroot/tmda/tmda/contrib/cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv4435

Modified Files:
        compile 
Log Message:
Added -m and -i options for use with RPM's.


Index: compile
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/cgi/compile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- compile     5 Dec 2002 18:29:22 -0000       1.3
+++ compile     14 Dec 2002 01:42:38 -0000      1.4
@@ -32,9 +32,17 @@
     --help
        Print this help message and exit.
 
+    -i <path>
+    --install-prefix <path>
+       Specify path to tmda-cgi.py other than the currect directory.
+
+    -m system-wide|single-user|no-su
+    --mode system-wide|single-user|no-su
+       Specify an operating mode.
+
     -n
     --no-su
-       Compile a CGI to run in no-su mode.
+       Compile a CGI to run in no-su mode.  Forces option "-m no-su".
 
     -t <file>
     --target <file>
@@ -45,6 +53,11 @@
 resulting CGI will run in system-wide mode.  Otherwise it will run in single-
 user mode. You may optionally specify the -n option to compile for no-su mode.
 
+The -i and -m options are seldom needed.  These options are for the rare cases
+when a user other than root needs to compile the program for use in system-
+wide mode.  For the resulting code to run correctly, root will have to chown
+the resulting program.
+
 The target may be specified on the command line with the -t option.
 
 Use the -c option to specify a different location for your TMDA configuration
@@ -60,13 +73,14 @@
 """
 
 import getopt
-import os
+import os.path
 import string
 import sys
 
 Program = sys.argv[0]
 Target  = "tmda-cgi"
 Perm    = 04755
+Path    = "."
 if os.geteuid():
   Mode = "single-user"
 else:
@@ -78,28 +92,42 @@
   sys.exit(Code)
 
 try:
-  Opts, Args = getopt.getopt(sys.argv[1:], "c:nht:",
-    ["config-file=", "help", "no-su", "target="])
+  Opts, Args = getopt.getopt(sys.argv[1:], "c:i:m:nht:",
+    ["config-file=", "help", "install-prefix=", "mode=", "no-su", "target="])
 except getopt.error, Msg:
   Usage(1, Msg)
 
 for Opt, Arg in Opts:
   if Opt in ("-h", "--help"):
     Usage(0)
-  elif Opt in ('-c', '--config-file'):
-    os.environ['TMDARC'] = Arg
-  elif Opt in ('-t', '--target'):
+  elif Opt in ("-c", "--config-file"):
+    os.environ["TMDARC"] = Arg
+  elif Opt in ("-i", "--install-prefix"):
+    Path = Arg
+  elif Opt in ("-t", "--target"):
     Target = Arg
-  elif Opt in ('-n', '--no-su'):
+  elif Opt in ("-m", "--mode"):
+    if not Arg in ("system-wide", "single-user", "no-su"):
+      Usage(1, "Valid modes are system-wide, single-user, and no-su")
+    Mode = Arg
+    if Arg == "no-su": Perm = 0755
+  elif Opt in ("-n", "--no-su"):
     Perm = 0755
     Mode = "no-su"
 
+# Validate path
+Path = os.path.abspath(Path)
+Temp = os.path.join(Path, "tmda-cgi.py")
+if not os.path.isfile(Temp):
+  print "Error: Could not locate %s" % Temp
+  sys.exit(1)
+
 # Create dirs.h
 F = open("dirs.h", "w")
 F.write("""#define PYTHON "%s"
 #define INSTALL "%s"
 #define MODE "%s"
-""" % (sys.executable, os.getcwd(), Mode))
+""" % (sys.executable, Path, Mode))
 if os.environ.has_key("TMDARC"):
   TMDARC = os.environ["TMDARC"]
   if TMDARC.find("~") < 0:

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to