3bc76e61462d — Malcolm Scott 7 years ago
Debian packaging
8 files changed, 170 insertions(+), 0 deletions(-)

A => debian/changelog
A => debian/compat
A => debian/control
A => debian/copyright
A => debian/default
A => debian/init
A => debian/rules
A => debian/source/format
A => debian/changelog +5 -0
@@ 0,0 1,5 @@ 
+nfw-redirector (1.0) trusty; urgency=medium
+
+  * Initial release.
+
+ -- Malcolm Scott <debianpkg@malc.org.uk>  Tue, 23 Sep 2014 15:54:07 +0100

          
A => debian/compat +1 -0
@@ 0,0 1,1 @@ 
+9

          
A => debian/control +18 -0
@@ 0,0 1,18 @@ 
+Source: nfw-redirector
+Maintainer: Malcolm Scott <debianpkg@malc.org.uk>
+Section: net
+Priority: optional
+Standards-Version: 3.9.5
+Build-Depends: debhelper (>= 9)
+
+Package: nfw-redirector
+Architecture: all
+Depends: python (>= 2.7), python-sh | python-pbs, python-flup, ${shlibs:Depends}, ${misc:Depends}
+Description: Serve redirects to a captive portal
+ nfw-redirector is a FastCGI application which will look up the visiting
+ user's link-layer (MAC) address and serve them a redirect to a captive
+ portal, passing the link-layer address, network address and originally-
+ requested URL.
+ .
+ It should be run on a router which intercepts HTTP connections, and is
+ designed for use with the 'nfw' Cambridge firewall suite.

          
A => debian/copyright +18 -0
@@ 0,0 1,18 @@ 
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: *
+Copyright: 2014 Malcolm Scott <debianpkg@malc.org.uk>
+License: /usr/share/common-licenses/GPL-2
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

          
A => debian/default +4 -0
@@ 0,0 1,4 @@ 
+URL="https://nfw.example.org/enrol"
+
+BIND_ADDRESS="localhost"
+BIND_PORT="8080"

          
A => debian/init +119 -0
@@ 0,0 1,119 @@ 
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          skeleton
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Trinity Hall captive portal redirector
+### END INIT INFO
+
+# Author: Malcolm Scott <mas90@trinhall.cam.ac.uk>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Trinity Hall captive portal redirector"
+NAME=redirector
+DAEMON=/usr/local/bin/redirector
+DAEMON_ARGS=""
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+	# Return
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --chuid nobody --exec $DAEMON --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --chuid nobody --exec $DAEMON -- \
+		$DAEMON_ARGS \
+		|| return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+	# Return
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+	#   other if a failure occurred
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	rm -f $PIDFILE
+	return "$RETVAL"
+}
+
+case "$1" in
+  start)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  status)
+	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+	;;
+  restart|force-reload)
+	#
+	# If the "reload" option is implemented then remove the
+	# 'force-reload' alias
+	#
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+		# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+:

          
A => debian/rules +4 -0
@@ 0,0 1,4 @@ 
+#!/usr/bin/make -f
+
+%:
+	dh $@

          
A => debian/source/format +1 -0
@@ 0,0 1,1 @@ 
+3.0 (native)