[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] don't hard code /etc/default; try to detect the correct one and bug the user to specify it, if that fails



commit d736b4b218077b09666f38e21723b00fca611df8
Author: Ximin Luo <infinity0@xxxxxxx>
Date:   Mon Nov 4 16:31:50 2013 +0000

    don't hard code /etc/default; try to detect the correct one and bug the user to specify it, if that fails
---
 facilitator/Makefile.am  |    5 +++--
 facilitator/configure.ac |    7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/facilitator/Makefile.am b/facilitator/Makefile.am
index 7708f21..6d4325b 100644
--- a/facilitator/Makefile.am
+++ b/facilitator/Makefile.am
@@ -1,13 +1,14 @@
 # our own variables
 
 fpfacilitatoruser = @fpfacilitatoruser@
+initconfdir = @initconfdir@
+
 # unfortunately sysvinit does not support having initscripts in /usr/local/etc
 # yet, so we have to hard code a path here. :(
 initscriptdir = /etc/init.d
 exampledir = $(docdir)/examples
 appenginedir = $(pkgdatadir)/appengine
 pkgconfdir = $(sysconfdir)/flashproxy
-initdefaultdir = $(sysconfdir)/default
 appengineconfdir = $(pkgconfdir)/reg-appengine
 
 # automake PLVs
@@ -15,7 +16,7 @@ appengineconfdir = $(pkgconfdir)/reg-appengine
 dist_bin_SCRIPTS = facilitator facilitator-email-poller facilitator-reg-daemon facilitator-reg facilitator.cgi fac.py
 if DO_INITSCRIPTS
 initscript_SCRIPTS = init.d/facilitator init.d/facilitator-email-poller init.d/facilitator-reg-daemon
-dist_initdefault_DATA = default/facilitator default/facilitator-email-poller default/facilitator-reg-daemon
+dist_initconf_DATA = default/facilitator default/facilitator-email-poller default/facilitator-reg-daemon
 endif
 
 dist_doc_DATA = doc/appengine-howto.txt doc/facilitator-howto.txt doc/gmail-howto.txt README
diff --git a/facilitator/configure.ac b/facilitator/configure.ac
index 397894f..32d5fa4 100644
--- a/facilitator/configure.ac
+++ b/facilitator/configure.ac
@@ -4,6 +4,13 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
 AC_ARG_VAR(fpfacilitatoruser, [the user/group for the facilitator to run as])
 fpfacilitatoruser="${fpfacilitatoruser:-flashproxy-fac}"
+AC_ARG_VAR(initconfdir, [directory for initscripts configuration])
+# Try to detect the appropriate conf dir. Several systems have both /etc/default
+# and /etc/sysconfig but latter is always primary.
+AC_CHECK_FILE(/etc/conf.d, [initconfdir="${initconfdir:-\$(sysconfdir)/conf.d}"], [# Gentoo/Arch
+AC_CHECK_FILE(/etc/sysconfig, [initconfdir="${initconfdir:-\$(sysconfdir)/sysconfig}"], [# RedHat/Fedora/Slax/Mandriva/SuSE
+AC_CHECK_FILE(/etc/default, [initconfdir="${initconfdir:-\$(sysconfdir)/default}"], [# Debian/Ubuntu
+AC_MSG_ERROR([could not determine system\'s initscripts config dir, please set initconfdir manually])])])])
 
 AC_PROG_LN_S
 AM_PATH_PYTHON



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits