commit 15f0aa4a1750793b1128ff893edd69434dd900ea Author: Ximin Luo infinity0@gmx.com Date: Tue Oct 15 16:14:23 2013 +0100
add more initscripts default files for users to override various options --- facilitator/Makefile.am | 2 +- facilitator/default/facilitator | 11 +++++++++++ facilitator/default/facilitator-email-poller | 11 ++++++++++- facilitator/default/facilitator-reg-daemon | 11 +++++++++++ facilitator/init.d/facilitator-email-poller.in | 25 ++++++++++++------------ facilitator/init.d/facilitator-reg-daemon.in | 11 +++++++++++ facilitator/init.d/facilitator.in | 11 +++++++++++ 7 files changed, 68 insertions(+), 14 deletions(-)
diff --git a/facilitator/Makefile.am b/facilitator/Makefile.am index d4a4021..fa1ba71 100644 --- a/facilitator/Makefile.am +++ b/facilitator/Makefile.am @@ -15,7 +15,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 -initdefault_DATA = default/facilitator-email-poller +dist_initdefault_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/default/facilitator b/facilitator/default/facilitator new file mode 100644 index 0000000..51ed4a1 --- /dev/null +++ b/facilitator/default/facilitator @@ -0,0 +1,11 @@ +# Change to "yes" to run the service. +RUN_DAEMON="no" + +# Uncomment this to log potentially sensitive information from your users. +# This may be useful for debugging or diagnosing functional problems, but +# should be avoided in a high-risk environment. +#UNSAFE_LOGGING="yes" + +# Set the port for this service to listen on. +# If not set, uses the default (9002). +#PORT=9002 diff --git a/facilitator/default/facilitator-email-poller b/facilitator/default/facilitator-email-poller index af2f8ca..42f4dc6 100644 --- a/facilitator/default/facilitator-email-poller +++ b/facilitator/default/facilitator-email-poller @@ -1,6 +1,15 @@ -# Change to "yes" to run the email poller. +# Change to "yes" to run the service. RUN_DAEMON="no"
+# Uncomment this to log potentially sensitive information from your users. +# This may be useful for debugging or diagnosing functional problems, but +# should be avoided in a high-risk environment. +#UNSAFE_LOGGING="yes" + # Replace this with the email address for your facilitator. # You should also edit the reg-email.pass file as needed. FACILITATOR_EMAIL_ADDR="invalid" + +# Set the host:port for the remote IMAP service to contact +# If not set, uses the default (imap.gmail.com:993). +#IMAPADDR="imap.gmail.com:993" diff --git a/facilitator/default/facilitator-reg-daemon b/facilitator/default/facilitator-reg-daemon new file mode 100644 index 0000000..d39be20 --- /dev/null +++ b/facilitator/default/facilitator-reg-daemon @@ -0,0 +1,11 @@ +# Change to "yes" to run the service. +RUN_DAEMON="no" + +# Uncomment this to log potentially sensitive information from your users. +# This may be useful for debugging or diagnosing functional problems, but +# should be avoided in a high-risk environment. +#UNSAFE_LOGGING="yes" + +# Set the port for this service to listen on. +# If not set, uses the default (9003). +#PORT=9003 diff --git a/facilitator/init.d/facilitator-email-poller.in b/facilitator/init.d/facilitator-email-poller.in index 44cc527..e39fb56 100755 --- a/facilitator/init.d/facilitator-email-poller.in +++ b/facilitator/init.d/facilitator-email-poller.in @@ -24,22 +24,23 @@ PIDFILE=@localstatedir@/run/$NAME.pid LOGFILE=@localstatedir@/log/$NAME.log CONFDIR=@sysconfdir@/flashproxy PRIVDROP_USER=@fpfacilitatoruser@ -DEFAULTSFILE=@sysconfdir@/default/$NAME - -# Include defaults if available -if [ -f $DEFAULTSFILE ] ; then - . $DEFAULTSFILE -fi - DAEMON=@bindir@/$NAME -DAEMON_ARGS="--email $FACILITATOR_EMAIL_ADDR --pass $CONFDIR/reg-email.pass --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER" +DAEMON_ARGS="--pass $CONFDIR/reg-email.pass --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER" +DEFAULTSFILE=@sysconfdir@/default/$NAME
# Exit if the package is not installed [ -x "$DAEMON" ] || exit 0
+# Read configuration variable file if it is present +[ -r "$DEFAULTSFILE" ] && . "$DEFAULTSFILE" + . /lib/init/vars.sh . /lib/lsb/init-functions
+[ "$UNSAFE_LOGGING" = "yes" ] && DAEMON_ARGS="$DAEMON_ARGS --unsafe-logging" +[ -n "$IMAPADDR" ] && DAEMON_ARGS="$DAEMON_ARGS --imap $IMAPADDR" +DAEMON_ARGS="$DAEMON_ARGS --email $FACILITATOR_EMAIL_ADDR" + # # Function that starts the daemon/service # @@ -83,10 +84,10 @@ do_stop()
case "$1" in start) - if [ "$RUN_DAEMON" != "yes" ]; then - log_action_msg "Not starting $DESC (Disabled in $DEFAULTSFILE)." - exit 0 - fi + if [ "$RUN_DAEMON" != "yes" ]; then + log_action_msg "Not starting $DESC (Disabled in $DEFAULTSFILE)." + exit 0 + fi [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in diff --git a/facilitator/init.d/facilitator-reg-daemon.in b/facilitator/init.d/facilitator-reg-daemon.in index 5126baa..aa4afde 100755 --- a/facilitator/init.d/facilitator-reg-daemon.in +++ b/facilitator/init.d/facilitator-reg-daemon.in @@ -26,10 +26,17 @@ CONFDIR=@sysconfdir@/flashproxy PRIVDROP_USER=@fpfacilitatoruser@ DAEMON=@bindir@/$NAME DAEMON_ARGS="--key $CONFDIR/reg-daemon.key --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER" +DEFAULTSFILE=@sysconfdir@/default/$NAME
# Exit if the package is not installed [ -x "$DAEMON" ] || exit 0
+# Read configuration variable file if it is present +[ -r "$DEFAULTSFILE" ] && . "$DEFAULTSFILE" + +[ "$UNSAFE_LOGGING" = "yes" ] && DAEMON_ARGS="$DAEMON_ARGS --unsafe-logging" +[ -n "$PORT" ] && DAEMON_ARGS="$DAEMON_ARGS --port $PORT" + . /lib/init/vars.sh . /lib/lsb/init-functions
@@ -76,6 +83,10 @@ do_stop()
case "$1" in start) + if [ "$RUN_DAEMON" != "yes" ]; then + log_action_msg "Not starting $DESC (Disabled in $DEFAULTSFILE)." + exit 0 + fi [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in diff --git a/facilitator/init.d/facilitator.in b/facilitator/init.d/facilitator.in index 53c27b4..d6dc0ec 100755 --- a/facilitator/init.d/facilitator.in +++ b/facilitator/init.d/facilitator.in @@ -30,13 +30,20 @@ CONFDIR=@sysconfdir@/flashproxy PRIVDROP_USER=@fpfacilitatoruser@ DAEMON=@bindir@/$NAME DAEMON_ARGS="-r $RELAY --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER" +DEFAULTSFILE=@sysconfdir@/default/$NAME
# Exit if the package is not installed [ -x "$DAEMON" ] || exit 0
+# Read configuration variable file if it is present +[ -r "$DEFAULTSFILE" ] && . "$DEFAULTSFILE" + . /lib/init/vars.sh . /lib/lsb/init-functions
+[ "$UNSAFE_LOGGING" = "yes" ] && DAEMON_ARGS="$DAEMON_ARGS --unsafe-logging" +[ -n "$PORT" ] && DAEMON_ARGS="$DAEMON_ARGS --port $PORT" + # # Function that starts the daemon/service # @@ -80,6 +87,10 @@ do_stop()
case "$1" in start) + if [ "$RUN_DAEMON" != "yes" ]; then + log_action_msg "Not starting $DESC (Disabled in $DEFAULTSFILE)." + exit 0 + fi [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in
tor-commits@lists.torproject.org