Skip to content
Permalink
Browse files
use GNU autotools to create an installable package, including docs
  • Loading branch information
Ximin Luo committed Sep 12, 2013
1 parent 5598643 commit 0080b8dff74c583682867eb190e49237fee3b9db
@@ -65,7 +65,10 @@ test:
./flashproxy-client-test

test-full: test
cd facilitator && make test
cd facilitator && \
{ test -x ./config.status && ./config.status || \
{ test -x ./configure || ./autogen.sh; } && ./configure; } \
&& make && make check
cd proxy && make test

.PHONY: all install dist sign dist-exe clean clean-all test test-full
@@ -0,0 +1,27 @@
# files build by autogen.sh
/aclocal.m4
/configure
/depcomp
/install-sh
/missing
/test-driver
/Makefile.in

# files built by ./configure
/init.d/facilitator
/init.d/facilitator-email-poller
/init.d/facilitator-reg-daemon
/Makefile
/config.status
/config.log

# files built by autoconf not meant for source-distribution
/autom4te.cache

# files for binary-distribution
/flashproxy-facilitator-*.tar.*

# files output by test-driver
/test-*.log
/*-test.log
/*-test.trs

This file was deleted.

@@ -0,0 +1,42 @@
# our own variables

fpfacilitatoruser = @fpfacilitatoruser@
initscriptdir = $(sysconfdir)/init.d
exampledir = $(docdir)/examples

# automake PLVs

dist_bin_SCRIPTS = facilitator facilitator-email-poller facilitator-reg-daemon facilitator-reg facilitator.cgi fac.py
initscript_SCRIPTS = init.d/facilitator init.d/facilitator-email-poller init.d/facilitator-reg-daemon

dist_doc_DATA = doc/appengine-howto.txt doc/facilitator-howto.txt doc/gmail-howto.txt README
dist_example_DATA = conf/fp-facilitator

dist_TESTS = facilitator-test

# stuff built from AC_CONFIG_FILES
# see http://www.gnu.org/software/automake/manual/html_node/Scripts.html
CLEANFILES = $(initscript_SCRIPTS)

# our own targets

post-install:
which adduser >/dev/null 2>&1 && \
adduser --quiet \
--system \
--disabled-password \
--home $(sysconfdir)/flashproxy \
--no-create-home \
--shell /bin/false \
--group \
$(fpfacilitatoruser) || \
useradd \
--system \
--home $(sysconfdir)/flashproxy \
-M \
--shell /bin/false \
$(fpfacilitatoruser)
for i in facilitator facilitator-email-poller facilitator-reg-daemon; do \
update-rc.d $$i defaults; \
/etc/init.d/$$i start; \
done
@@ -0,0 +1,2 @@
#!/bin/sh
autoreconf -if
@@ -0,0 +1,27 @@
# This is an example apache2 config for serving the facilitator.
#
# You can edit this file according to the instructions below, then copy it to
# /etc/apache2/sites-available/fp-facilitator, or wherever is appropriate. Then
# you can run `a2ensite fp-facilitator` to enable it.
#
<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
MaxClients 256

CustomLog ${APACHE_LOG_DIR}/fp-access.log common
ErrorLog ${APACHE_LOG_DIR}/fp-error.log
LogLevel warn
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

Header add Strict-Transport-Security "max-age=15768000"
</VirtualHost>
@@ -0,0 +1,13 @@
AC_PREREQ([2.69])
AC_INIT([flashproxy-facilitator], [1.3])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AC_ARG_VAR(fpfacilitatoruser, [the user/group for the facilitator to run as])
fpfacilitatoruser="${fpfacilitatoruser:-flashproxy-fac}"

AC_CONFIG_FILES([Makefile
init.d/facilitator
init.d/facilitator-email-poller
init.d/facilitator-reg-daemon])

AC_OUTPUT
@@ -87,10 +87,6 @@ Restart servers.

== Facilitator program installation

Create the user the daemons will run as.

# useradd --shell /usr/sbin/nologin --system --home /nonexistent -M facilitator-nobody

Install the programs.

# cd
@@ -103,6 +99,13 @@ This installs facilitator.cgi, facilitator, facilitator-email-poller,
facilitator-reg-daemon, facilitator-reg, and fac.py to /usr/local/bin.
It also installs System V init files to /etc/init.d/.

Do post-installation tasks.

# make postinst

This creates a user for the daemons to run as, and sets up the init.d
scripts in the default system runlevels.

=== Registration daemon setup

The facilitator-reg-daemon program requires a private RSA key (used to
@@ -119,13 +122,6 @@ reg-daemon.pub into the appropriate place.
Install reg-daemon.key /etc/flashproxy to match what the init script
expects.

=== Init script setup

# update-rc.d facilitator defaults
# /etc/init.d/facilitator start
# update-rc.d facilitator-reg-daemon defaults
# /etc/init.d/facilitator-reg-daemon start

== HTTP server setup

Apache is the web server that runs the CGI program.
@@ -138,24 +134,9 @@ Edit /etc/apache2/ports.conf and comment out the port 80 configuration.
# NameVirtualHost *:80
# Listen 80

Create a new file /etc/apache2/sites-available/fp-facilitator with
these contents:
MaxClients 256
<VirtualHost *:443>
ServerName fp-facilitator.example.com
DocumentRoot /dev/null
ScriptAliasMatch ^(.*) /usr/local/bin/facilitator.cgi$1
CustomLog /dev/null common
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
SSLEngine on
SSLCertificateFile /etc/apache2/fp-facilitator.pem
SSLCertificateChainFile /etc/apache2/intermediate.pem
Header add Strict-Transport-Security "max-age=15768000"
</VirtualHost>
intermediate.pem is a possible intermediate certificate file provided by
the CA; if you did not get one, then leave off the
SSLCertificateChainFile line.
Edit conf/fp-facilitator as per the instructions given in that file, and
install it to /etc/apache2/sites-available/fp-facilitator or whatever is
appropriate for your apache2 installation.

Link the configured site into sites-enabled.
# a2ensite fp-facilitator
@@ -17,13 +17,15 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Flash proxy email rendezvous poller"
NAME=facilitator-email-poller
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
CONFDIR=/etc/flashproxy
PRIVDROP_USER=facilitator-nobody
DAEMON=/usr/local/bin/$NAME

prefix=@prefix@
exec_prefix=@exec_prefix@
PIDFILE=@localstatedir@/run/$NAME.pid
LOGFILE=@localstatedir@/log/$NAME.log
CONFDIR=@sysconfdir@/flashproxy
PRIVDROP_USER=@fpfacilitatoruser@
DAEMON=@bindir@/$NAME
DAEMON_ARGS="--pass $CONFDIR/reg-email.pass --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER"
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@@ -111,7 +113,7 @@ case "$1" in
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
@@ -17,13 +17,15 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Flash proxy local registration daemon"
NAME=facilitator-reg-daemon
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
CONFDIR=/etc/flashproxy
PRIVDROP_USER=facilitator-nobody
DAEMON=/usr/local/bin/$NAME

prefix=@prefix@
exec_prefix=@exec_prefix@
PIDFILE=@localstatedir@/run/$NAME.pid
LOGFILE=@localstatedir@/log/$NAME.log
CONFDIR=@sysconfdir@/flashproxy
PRIVDROP_USER=@fpfacilitatoruser@
DAEMON=@bindir@/$NAME
DAEMON_ARGS="--key $CONFDIR/reg-daemon.key --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER"
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@@ -111,7 +113,7 @@ case "$1" in
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
@@ -21,12 +21,15 @@ RELAY=173.255.221.44:9901
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="Flash proxy facilitator"
NAME=facilitator
PIDFILE=/var/run/$NAME.pid
LOGFILE=/var/log/$NAME.log
PRIVDROP_USER=facilitator-nobody
DAEMON=/usr/local/bin/$NAME

prefix=@prefix@
exec_prefix=@exec_prefix@
PIDFILE=@localstatedir@/run/$NAME.pid
LOGFILE=@localstatedir@/log/$NAME.log
CONFDIR=@sysconfdir@/flashproxy
PRIVDROP_USER=@fpfacilitatoruser@
DAEMON=@bindir@/$NAME
DAEMON_ARGS="-r $RELAY --log $LOGFILE --pidfile $PIDFILE --privdrop-user $PRIVDROP_USER"
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@@ -114,7 +117,7 @@ case "$1" in
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

0 comments on commit 0080b8d

Please sign in to comment.