Package: libnet-proxy-perl
Version: 0.12-1+sslhinit+1
Severity: wishlist
Tags: patch

It would be nice if the package could provide an initscript for sslh. Here is
a patch that does just that.

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libnet-proxy-perl depends on:
ii  libwww-perl                   5.813-1    WWW client/server library for Perl
ii  perl                          5.10.0-19  Larry Wall's Practical Extraction

libnet-proxy-perl recommends no packages.

Versions of packages libnet-proxy-perl suggests:
ii  lsb-base                      3.2-20     Linux Standard Base 3.2 init scrip

-- no debconf information
Wed May 20 14:15:39 UTC 2009  Alexandre Rossi <alexandre.ro...@gmail.com>
  * init
diff -rN -u old-libnet-proxy-perl-0.12/debian/control new-libnet-proxy-perl-0.12/debian/control
--- old-libnet-proxy-perl-0.12/debian/control	2009-05-20 14:17:05.000000000 +0000
+++ new-libnet-proxy-perl-0.12/debian/control	2009-05-20 14:17:05.000000000 +0000
@@ -10,6 +10,7 @@
 Package: libnet-proxy-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, libwww-perl
+Suggests: lsb-base (>= 3.0-6)
 Description: Framework for proxying network connections in many ways
  This module is a framework for creating various kinds of network
  proxies in a very simple way.
diff -rN -u old-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.default new-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.default
--- old-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.default	1970-01-01 00:00:00.000000000 +0000
+++ new-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.default	2009-05-20 14:17:05.000000000 +0000
@@ -0,0 +1,8 @@
+# defaults file for sslh
+
+SSLH_ENABLE=false
+
+# what extra options to give sslh?
+# usage: sslh [ -p [host:]port ] [ -t timeout ]
+#             [ --ssh [host:]port ] [ --ssl [host:]port ]
+SSLH_OPTIONS=''
diff -rN -u old-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.init new-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.init
--- old-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.init	1970-01-01 00:00:00.000000000 +0000
+++ new-libnet-proxy-perl-0.12/debian/libnet-proxy-perl.sslh.init	2009-05-20 14:17:05.000000000 +0000
@@ -0,0 +1,129 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          sslh
+# Required-Start:    $network
+# Required-Stop:     $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: sslh
+# Description:       Launch the SSH/HTTPS Service multiplexer
+### END INIT INFO
+
+# Author: Alexandre Rossi <alexandre.ro...@gmail.com>
+
+# 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="SSH/HTTPS service multiplexer"
+NAME=sslh
+DAEMON=/usr/bin/$NAME
+INTERPRETER=/usr/bin/perl
+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
+
+# Exit if the service is disabled
+[ "$SSLH_ENABLE" == "true" ] || exit 0
+
+DAEMON_ARGS="$SSLH_OPTIONS"
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+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 --exec $INTERPRETER --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --pidfile $PIDFILE -m -b --exec $DAEMON -- \
+		$DAEMON_ARGS \
+		|| return 2
+}
+
+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
+	# Wait for children to finish too if this is a daemon that forks
+	# and if the daemon is only ever run from this initscript.
+	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+	[ "$?" = 2 ] && return 2
+	rm -f $PIDFILE
+	return "$RETVAL"
+}
+
+do_status(){
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $INTERPRETER --test > /dev/null
+}
+
+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
+	;;
+  restart|force-reload)
+	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
+	;;
+  status)
+	echo -n "Status of $DESC: "
+	do_status
+	if [ "$?" = 1 ]; then
+		echo "alive."
+	else
+		echo "dead."
+		exit 1
+	fi
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+:
diff -rN -u old-libnet-proxy-perl-0.12/debian/rules new-libnet-proxy-perl-0.12/debian/rules
--- old-libnet-proxy-perl-0.12/debian/rules	2009-05-20 14:17:05.000000000 +0000
+++ new-libnet-proxy-perl-0.12/debian/rules	2009-05-20 14:17:05.000000000 +0000
@@ -62,6 +62,7 @@
 	dh_installdocs README
 	dh_installexamples
 	dh_installchangelogs Changes
+	dh_installinit --name=sslh -u"start 16 2 3 4 5 . stop 84 1 ."
 	dh_perl
 	dh_compress
 	dh_fixperms

Reply via email to