[tor-commits] [flashproxy/master] add the infrastructure needed to install facilitator.cgi in the right place

infinity0 at torproject.org infinity0 at torproject.org
Thu Nov 21 13:18:46 UTC 2013


commit 1491303f9118c872effb4a550dcba368cbf36853
Author: Ximin Luo <infinity0 at gmx.com>
Date:   Wed Nov 6 13:37:08 2013 +0000

    add the infrastructure needed to install facilitator.cgi in the right place
---
 facilitator/.gitignore                      |    5 +++--
 facilitator/Makefile.am                     |   17 ++++++++++++++--
 facilitator/configure.ac                    |   12 +++++++++++
 facilitator/examples/fp-facilitator.conf    |   29 ---------------------------
 facilitator/examples/fp-facilitator.conf.in |   28 ++++++++++++++++++++++++++
 5 files changed, 58 insertions(+), 33 deletions(-)

diff --git a/facilitator/.gitignore b/facilitator/.gitignore
index 9c6d1c7..cd4d36b 100644
--- a/facilitator/.gitignore
+++ b/facilitator/.gitignore
@@ -1,5 +1,6 @@
 # files build by autogen.sh
 /aclocal.m4
+/autom4te.cache
 /configure
 /depcomp
 /install-sh
@@ -15,8 +16,8 @@
 /config.status
 /config.log
 
-# files built by autoconf not meant for source-distribution
-/autom4te.cache
+# files built by make
+/examples/fp-facilitator.conf
 
 # files for binary-distribution
 /flashproxy-facilitator-*.tar.*
diff --git a/facilitator/Makefile.am b/facilitator/Makefile.am
index 6960e32..7e117ba 100644
--- a/facilitator/Makefile.am
+++ b/facilitator/Makefile.am
@@ -2,6 +2,9 @@
 
 fpfacilitatoruser = @fpfacilitatoruser@
 initconfdir = @initconfdir@
+# TODO(infinity0): switch this to @cgibindir@ once we replace fac.py with
+# flashproxy-common, so that we install facilitator.cgi in the right place
+cgibindir = @bindir@
 
 # unfortunately sysvinit does not support having initscripts in /usr/local/etc
 # yet, so we have to hard code a path here. :(
@@ -13,7 +16,8 @@ appengineconfdir = $(pkgconfdir)/reg-appspot
 
 # automake PLVs
 
-dist_bin_SCRIPTS = facilitator facilitator-email-poller facilitator-reg-daemon facilitator-reg facilitator.cgi fac.py
+dist_bin_SCRIPTS = facilitator facilitator-email-poller facilitator-reg-daemon facilitator-reg fac.py
+dist_cgibin_SCRIPTS = facilitator.cgi
 if DO_INITSCRIPTS
 initscript_SCRIPTS = init.d/facilitator init.d/facilitator-email-poller init.d/facilitator-reg-daemon
 dist_initconf_DATA = default/facilitator default/facilitator-email-poller default/facilitator-reg-daemon
@@ -23,6 +27,8 @@ dist_doc_DATA = doc/appspot-howto.txt doc/facilitator-design.txt doc/email-howto
 dist_example_DATA = examples/fp-facilitator.conf examples/reg-email.pass
 dist_appengine_DATA = appengine/app.yaml appengine/config.go appengine/fp-reg.go appengine/README
 appengineconf_DATA = appengine/config.go
+CLEANFILES = examples/fp-facilitator.conf
+EXTRA_DIST = examples/fp-facilitator.conf.in $(TESTS)
 
 TESTS = facilitator-test.py
 # see http://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html#index-TEST_005fEXTENSIONS
@@ -31,10 +37,17 @@ PY_LOG_COMPILER = $(PYTHON)
 AM_TESTS_ENVIRONMENT = PYTHONPATH='$(srcdir)'; export PYTHONPATH;
 AM_PY_LOG_FLAGS =
 
-EXTRA_DIST = $(TESTS)
+# AC_CONFIG_FILES doesn't fully-expand directory variables
+# see http://www.gnu.org/software/automake/manual/automake.html#Scripts
+subst_vars = sed -e 's,[@]cgibindir[@],$(cgibindir),g'
 
 # our own targets
 
+examples/fp-facilitator.conf: examples/fp-facilitator.conf.in Makefile
+# mkdir needed for out-of-source build
+	mkdir -p $$(dirname "$@")
+	$(subst_vars) "$<" > "$@"
+
 # The {pre,post}-{install,remove} targets are just given as reference, and
 # ought to be separate scripts as part of your distro's installation process.
 # They are intentionally not linked to the install target since they require
diff --git a/facilitator/configure.ac b/facilitator/configure.ac
index a89e01b..1b589a7 100644
--- a/facilitator/configure.ac
+++ b/facilitator/configure.ac
@@ -26,6 +26,18 @@ AC_MSG_ERROR([could not determine system initscripts config dir; please set init
 fi
 fi
 
+# Try to detect cgi-bin directory, falling back to $(libexec) if not found
+# from http://wiki.apache.org/httpd/DistrosDefaultLayout
+AC_ARG_VAR(cgibindir, [directory for CGI executables])
+if test "x$cgibindir" = x; then
+AC_CHECK_FILE(/usr/lib/cgi-bin, [cgibindir='$(libdir)/cgi-bin'], [
+AC_CHECK_FILE(/var/www/cgi-bin, [cgibindir='/var/www/cgi-bin'], [
+AC_CHECK_FILE(/srv/httpd/cgi-bin, [cgibindir='/srv/httpd/cgi-bin'], [
+AC_MSG_WARN([could not determine system CGI executables dir, using \$(libexecdir); set cgibindir to override.])
+cgibindir='$(libexecdir)'
+])])])
+fi
+
 AC_PROG_LN_S
 AM_PATH_PYTHON
 
diff --git a/facilitator/examples/fp-facilitator.conf b/facilitator/examples/fp-facilitator.conf
deleted file mode 100644
index 40182cc..0000000
--- a/facilitator/examples/fp-facilitator.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-# This is an example apache2 config for serving the facilitator.
-#
-# For instructions on how to install it, see doc/http-howto.txt. You
-# should also edit the contents according to the instructions below.
-#
-MaxClients 256
-<VirtualHost *:443>
-	# Update this with your hostname!
-	ServerName fp-facilitator.example.com
-	DocumentRoot /dev/null
-	# Make sure the path below matchs where you installed the facilitator.
-	ScriptAliasMatch ^(.*) /usr/bin/facilitator.cgi$1
-
-	# Non-Debian distros will need to tweak this too
-	CustomLog ${APACHE_LOG_DIR}/fp-access.log common
-	ErrorLog ${APACHE_LOG_DIR}/fp-error.log
-	LogLevel warn
-
-	# requires mod_ssl
-	SSLEngine on
-	# Manually install your certificate to the following location.
-	SSLCertificateFile /etc/apache2/fp-facilitator.pem
-	# If you got an intermediate certificate, uncomment the following line
-	# and install the certificate to that location too.
-	#SSLCertificateChainFile /etc/apache2/fp-intermediate.pem
-
-	# requires mod_headers
-	Header add Strict-Transport-Security "max-age=15768000"
-</VirtualHost>
diff --git a/facilitator/examples/fp-facilitator.conf.in b/facilitator/examples/fp-facilitator.conf.in
new file mode 100644
index 0000000..729d85e
--- /dev/null
+++ b/facilitator/examples/fp-facilitator.conf.in
@@ -0,0 +1,28 @@
+# This is an example apache2 config for serving the facilitator.
+#
+# For instructions on how to install it, see doc/http-howto.txt. You
+# should also edit the contents according to the instructions below.
+#
+MaxClients 256
+<VirtualHost *:443>
+	# Update this with your hostname!
+	ServerName fp-facilitator.example.com
+	DocumentRoot /dev/null
+	ScriptAliasMatch ^(.*) @cgibindir@/facilitator.cgi$1
+
+	# Non-Debian distros will need to tweak this too
+	CustomLog ${APACHE_LOG_DIR}/fp-access.log common
+	ErrorLog ${APACHE_LOG_DIR}/fp-error.log
+	LogLevel warn
+
+	# requires mod_ssl
+	SSLEngine on
+	# Manually install your certificate to the following location.
+	SSLCertificateFile /etc/apache2/fp-facilitator.pem
+	# If you got an intermediate certificate, uncomment the following line
+	# and install the certificate to that location too.
+	#SSLCertificateChainFile /etc/apache2/fp-intermediate.pem
+
+	# requires mod_headers
+	Header add Strict-Transport-Security "max-age=15768000"
+</VirtualHost>





More information about the tor-commits mailing list