Browse Source

Rework Debianisation

Christoph Biedl 10 years ago
parent
commit
004be564e3
10 changed files with 176 additions and 235 deletions
  1. 1 1
      debian/compat
  2. 3 2
      debian/control
  3. 18 20
      debian/copyright
  4. 0 103
      debian/init.d
  5. 9 105
      debian/rules
  6. 2 3
      debian/default
  7. 0 0
      debian/softflowd.docs
  8. 141 0
      debian/softflowd.init
  9. 1 0
      debian/source/format
  10. 1 1
      debian/watch

+ 1 - 1
debian/compat

@@ -1 +1 @@
-5
+7

+ 3 - 2
debian/control

@@ -2,8 +2,9 @@ Source: softflowd
 Section: net
 Priority: extra
 Maintainer: Christoph Biedl <debian.packages.hhqj@manchmal.in-ulm.de>
-Build-Depends: debhelper (>= 5), autotools-dev, libpcap0.8-dev, autoconf
-Standards-Version: 3.8.4
+Build-Depends: debhelper (>= 7.0.50~),
+ autoconf, autotools-dev, libpcap0.8-dev
+Standards-Version: 3.9.1
 Homepage: http://www.mindrot.org/projects/softflowd/
 
 Package: softflowd

+ 18 - 20
debian/copyright

@@ -1,12 +1,13 @@
-This package was debianized by Christoph Biedl
-<debian.packages.hhqj@manchmal.in-ulm.de> on Tue, 24 Jul 2007 11:48:21 +0200.
+This package was debianized by
+Christoph Biedl <debian.packages.hhqj@manchmal.in-ulm.de>
+on Tue, 24 Jul 2007 11:48:21 +0200.
 
-It was downloaded from <http://www.mindrot.org/projects/softflowd>
+It was downloaded using 'hg clone https://softflowd.googlecode.com/hg/ softflowd'
 
 License:
 
   Original code is licensed under the following BSD-style license:
-  
+
   /*
    * Copyright 2002-2006 Damien Miller <djm@mindrot.org> All rights reserved.
    *
@@ -30,9 +31,9 @@ License:
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
-  
+
   closefrom.c:
-  
+
   /*
    * Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com>
    *
@@ -48,9 +49,9 @@ License:
    * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    */
-  
+
   convtime.c:
-  
+
   /*
    * Copyright (c) 2001 Kevin Steves.  All rights reserved.
    *
@@ -74,9 +75,9 @@ License:
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
-  
+
   daemon.c:
-  
+
   /*-
    * Copyright (c) 1990, 1993
    *	The Regents of the University of California.  All rights reserved.
@@ -105,9 +106,9 @@ License:
    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    */
-  
+
   strlcat.c, strlcpy.c:
-  
+
   /*
    * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
    *
@@ -123,9 +124,9 @@ License:
    * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    */
-  
+
   sys-tree.h:
-  
+
   /*
    * Copyright 2002 Niels Provos <provos@citi.umich.edu>
    * All rights reserved.
@@ -151,10 +152,7 @@ License:
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
 
-On Debian systems, the complete text of the BSD License can be 
-found in `/usr/share/common-licenses/BSD'.
-
-The Debian packaging is (C) 2007, Christoph Biedl
-<debian.packages.hhqj@manchmal.in-ulm.de> and is licensed under the GPL, see
-`/usr/share/common-licenses/GPL'.
 
+The Debian packaging is (C) 2007-2011,
+Christoph Biedl <debian.packages.hhqj@manchmal.in-ulm.de>
+and is licensed under the GPL, see `/usr/share/common-licenses/GPL'.

+ 0 - 103
debian/init.d

@@ -1,103 +0,0 @@
-#! /bin/sh
-
-### BEGIN INIT INFO
-# Provides:          softflowd
-# Required-Start:    $network $local_fs $remote_fs $syslog
-# Required-Stop:     $network $local_fs $remote_fs $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Flow-based network traffic analyser.
-### END INIT INFO
-
-# skeleton	example file to build /etc/init.d/ scripts.
-#		This file should be used to construct scripts for /etc/init.d.
-#
-#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
-#		Modified for Debian 
-#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
-#
-# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
-#
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/softflowd
-NAME=softflowd
-DESC=softflowd
-DEFAULT=/etc/default/softflowd
-PRIVDROP_CHROOT_DIR=/var/run/softflowd/chroot
-
-test -x $DAEMON || exit 0
-
-INTERFACE=
-OPTIONS=
-
-# Include softflowd defaults if available
-if [ -f $DEFAULT ] ; then
-	. $DEFAULT
-fi
-
-if [ "$INTERFACE" = "" ] ; then
-    echo "Not starting $NAME"
-    echo "Edit $DEFAULT and define the INTERFACE variable"
-    exit 0
-fi
-
-set -e
-
-[ -d $PRIVDROP_CHROOT_DIR ] || mkdir -p $PRIVDROP_CHROOT_DIR
-
-case "$1" in
-  start)
-	echo -n "Starting $DESC: "
-	start-stop-daemon --start --oknodo --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON -- -i "$INTERFACE" $OPTIONS
-	echo "$NAME."
-	;;
-  stop)
-	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON
-	echo "$NAME."
-	;;
-  #reload)
-	#
-	#	If the daemon can reload its config files on the fly
-	#	for example by sending it SIGHUP, do it here.
-	#
-	#	If the daemon responds to changes in its config file
-	#	directly anyway, make this a do-nothing entry.
-	#
-	# echo "Reloading $DESC configuration files."
-	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
-	#	/var/run/$NAME.pid --exec $DAEMON
-  #;;
-  force-reload)
-	#
-	#	If the "reload" option is implemented, move the "force-reload"
-	#	option to the "reload" entry above. If not, "force-reload" is
-	#	just the same as "restart" except that it does nothing if the
-	#   daemon isn't already running.
-	# check wether $DAEMON is running. If so, restart
-	start-stop-daemon --stop --test --quiet --pidfile \
-		/var/run/$NAME.pid --exec $DAEMON \
-	&& $0 restart \
-	|| exit 0
-	;;
-  restart)
-    echo -n "Restarting $DESC: "
-	start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON
-	sleep 1
-	start-stop-daemon --start --oknodo --quiet --pidfile /var/run/$NAME.pid \
-		--exec $DAEMON -- -i "$INTERFACE" $OPTIONS
-	echo "$NAME."
-	;;
-  *)
-	N=/etc/init.d/$NAME
-	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
-	echo "Usage: $N {start|stop|restart|force-reload}" >&2
-	exit 1
-	;;
-esac
-
-exit 0

+ 9 - 105
debian/rules

@@ -1,108 +1,12 @@
 #!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+override_dh_auto_configure:
+	autoreconf
+	dh_auto_configure -- \
+		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+		--prefix=/usr --mandir=\$${prefix}/share/man \
+		--infodir=\$${prefix}/share/info \
+		CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
 
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-
-config.status: configure
-	dh_testdir
-	# Add here commands to configure the package.
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-	cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-	cp -f /usr/share/misc/config.guess config.guess
-endif
-	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
-
-
-configure:
-	autoconf
-
-build: build-stamp
-
-build-stamp:  config.status
-	dh_testdir
-	# Add here commands to compile the package.
-	$(MAKE)
-	#docbook-to-man debian/softflowd.sgml > softflowd.1
-
-	touch $@
-
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp 
-
-	# Add here commands to clean up after the build process.
-	[ ! -f Makefile ] || $(MAKE) distclean
-	rm -f config.sub config.guess
-
-	dh_clean 
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k 
-	dh_installdirs
-
-	# Add here commands to install the package into debian/softflowd.
-	$(MAKE) prefix=$(CURDIR)/debian/softflowd/usr install
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs ChangeLog
-	dh_installdocs
-	dh_installexamples
-#	dh_install
-#	dh_installmenu
-	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installpam
-#	dh_installmime
-#	dh_python
-	dh_installinit
-#	dh_installcron
-#	dh_installinfo
-	dh_installman
-	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-#	dh_perl
-#	dh_makeshlibs
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
+%:
+	dh $@

+ 2 - 3
debian/default

@@ -1,6 +1,6 @@
 #
 # configuration for softflowd
-# 
+#
 # note: softflowd will not start without an interface configured.
 
 # The interface softflowd listens on.
@@ -8,7 +8,6 @@ INTERFACE=""
 
 # Further options for softflowd, see "man softflowd" for details.
 # You should at least define a host and a port where the accounting
-# datagrams should be sent to, e.g. 
+# datagrams should be sent to, e.g.
 # OPTIONS="-n 127.0.0.1:9995"
 OPTIONS=""
-

debian/docs → debian/softflowd.docs


+ 141 - 0
debian/softflowd.init

@@ -0,0 +1,141 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides:          softflowd
+# Required-Start:    $network $remote_fs $syslog
+# Required-Stop:     $network $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Flow-based network traffic analyser.
+### END INIT INFO
+
+# Author: Christoph Biedl <debian.packages.hhqj@manchmal.in-ulm.de>
+# Based on /etc/init.d/skeleton, written by
+# Miquel van Smoorenburg <miquels@cistron.nl>,
+# modified for Debian by Ian Murdock <imurdock@gnu.ai.mit.edu>.
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DAEMON=/usr/sbin/softflowd
+NAME=softflowd
+DESC="Flow-based network traffic analyser"
+DEFAULT=/etc/default/$NAME
+PIDFILE=/var/run/$NAME.pid
+PRIVDROP_CHROOT_DIR=/var/run/softflowd/chroot
+
+test -x "$DAEMON" || exit 0
+
+# Include softflowd defaults if available
+INTERFACE=
+OPTIONS=
+[ -r "$DEFAULT" ] && . "$DEFAULT"
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+. /lib/lsb/init-functions
+
+
+case "$1" in
+start|restart|force-reload)
+    if [ -z "$INTERFACE" ] ; then
+	log_daemon_msg "NOT starting $DESC" "$NAME"
+	log_action_msg "\nEdit $DEFAULT and define the INTERFACE variable"
+	log_end_msg 1
+	exit 0
+    fi
+    ;;
+esac
+
+[ -d "$PRIVDROP_CHROOT_DIR" ] || mkdir -p "$PRIVDROP_CHROOT_DIR"
+
+#
+# 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 \
+	--exec $DAEMON --test > /dev/null || \
+	return 1
+    start-stop-daemon --start --quiet --pidfile $PIDFILE \
+	--exec $DAEMON -- -i "$INTERFACE" $OPTIONS || \
+	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
+    # Wait for children to finish too if this is a daemon that forks
+    # and if the daemon is only ever run from this initscript.
+    # If the above conditions are not satisfied then add some other code
+    # that waits for the process to drop all resources that could be
+    # needed by services started subsequently.  A last resort is to
+    # sleep for some time.
+    start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \
+	--exec $DAEMON
+    [ "$?" = 2 ] && return 2
+    # Many daemons don't delete their pidfiles when they exit.
+    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)
+    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
+
+:

+ 1 - 0
debian/source/format

@@ -0,0 +1 @@
+3.0 (quilt)

+ 1 - 1
debian/watch

@@ -1,3 +1,3 @@
 version=3
 
-http://www.mindrot.org/files/softflowd/softflowd-(.+)\.tar\.gz
+http://softflowd.googlecode.com/files/softflowd-(.+).tar.gz