From: Quentin Smith Date: Mon, 21 Dec 2009 05:05:15 +0000 (-0500) Subject: Properly separate the auth.fcgi and unauth.fcgi scripts X-Git-Tag: 0.1.1~3^2 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/refs/heads/cherrypy-rebased?hp=dcc31a134b159000ef724866f6bd02d5beb076ff Properly separate the auth.fcgi and unauth.fcgi scripts svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2739 --- diff --git a/code/auth.fcgi b/code/auth.fcgi deleted file mode 120000 index b94e858..0000000 --- a/code/auth.fcgi +++ /dev/null @@ -1 +0,0 @@ -invirt.fcgi \ No newline at end of file diff --git a/code/auth.fcgi b/code/auth.fcgi new file mode 100755 index 0000000..96a8bcf --- /dev/null +++ b/code/auth.fcgi @@ -0,0 +1,3 @@ +#!/bin/sh + +exec ./invirt.fcgi auth "$@" diff --git a/code/invirt.fcgi b/code/invirt.fcgi index c01eb7f..0bce132 100755 --- a/code/invirt.fcgi +++ b/code/invirt.fcgi @@ -11,26 +11,30 @@ dev = False base_dir = os.path.dirname(__file__) def usage(): - print >>sys.stderr, """%s [config] + argv0_dir = os.path.dirname(sys.argv[0]) + print >>sys.stderr, """%s [config] +%s/auth.fcgi [config] +%s/unauth.fcgi [config] Run server as FastCGI, with CherryPy config from "main.conf". With `config`, run standalone with CherryPy config from `config`. Run this script as either 'auth.fcgi' or 'unauth.fcgi', to get -the authenticated or unauthenticated site respectively. -""" % sys.argv[0] +the authenticated or unauthenticated site respectively, or pass +'auth' or 'unauth' as the first parameter. +""" % (sys.argv[0], argv0_dir, argv0_dir) sys.exit(2) if __name__ == "__main__": - if len(sys.argv) > 2: + if len(sys.argv) > 3 or len(sys.argv) == 1 or '-h' in sys.argv or '--help' in sys.argv: usage() - if len(sys.argv) > 1: - if sys.argv[1] in ('-h', '--help'): - usage() - conf_file = sys.argv[1] + if len(sys.argv) == 3: + mode = sys.argv[1] + conf_file = sys.argv[2] dev = True else: + mode = sys.argv[1] conf_file = os.path.join(base_dir, 'main.conf') app_config = { @@ -39,10 +43,12 @@ if __name__ == "__main__": }, } - if os.path.basename(sys.argv[0]).startswith('auth'): + if mode.startswith('auth'): root = main.InvirtWeb() - elif os.path.basename(sys.argv[0]).startswith('unauth'): + app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-auth-web-templatecache" + elif mode.startswith('unauth'): root = main.InvirtUnauthWeb() + app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-unauth-web-templatecache" else: usage() diff --git a/code/main.conf b/code/main.conf index 6381f19..85cad69 100644 --- a/code/main.conf +++ b/code/main.conf @@ -2,7 +2,6 @@ [global] #auto_reload doesn't work with FastCGI engine.auto_reload = False -tools.mako.module_directory = "/tmp/invirt-web-templatecache" tools.remote_user_login.on = True engine.SIGHUP = None diff --git a/code/unauth.fcgi b/code/unauth.fcgi deleted file mode 120000 index b94e858..0000000 --- a/code/unauth.fcgi +++ /dev/null @@ -1 +0,0 @@ -invirt.fcgi \ No newline at end of file diff --git a/code/unauth.fcgi b/code/unauth.fcgi new file mode 100755 index 0000000..75bac9c --- /dev/null +++ b/code/unauth.fcgi @@ -0,0 +1,3 @@ +#!/bin/sh + +exec ./invirt.fcgi unauth "$@" diff --git a/debian/changelog b/debian/changelog index b37745c..52317d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +invirt-web (0.1.1) unstable; urgency=low + + * Use a different Mako template cache for auth.fcgi and unauth.fcgi + * Use shell scripts for the auth.fcgi and unauth.fcgi so that Apache + will not think they are the same script. + + -- Quentin Smith Sun, 20 Dec 2009 23:53:17 -0500 + invirt-web (0.1.0) unstable; urgency=low [Quentin Smith]