--- ctdb-1.0.99.orig/debian/ctdb.links
+++ ctdb-1.0.99/debian/ctdb.links
@@ -0,0 +1 @@
+
--- ctdb-1.0.99.orig/debian/rules
+++ ctdb-1.0.99/debian/rules
@@ -0,0 +1,138 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+# Set the host and build architectures for use with config.cache loading,
+# cross-building, etc.
+DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_ARCH_OS	:= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+
+export DEB_HOST_GNU_TYPE
+export DEB_BUILD_GNU_TYPE
+export DEB_HOST_ARCH_OS
+
+CFLAGS = -g -Wall
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+  CFLAGS += -O0
+else
+  CFLAGS += -O2
+endif
+
+include /usr/share/quilt/quilt.make
+
+DESTDIR=$(CURDIR)/debian/ctdb
+
+conf_args = \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--localstatedir=/var/lib \
+		--with-logdir=/var/log
+
+configure: patch configure-stamp
+configure-stamp:
+	dh_testdir
+	CFLAGS="$(CFLAGS)" ./configure $(conf_args)
+	touch configure-stamp
+
+#Architecture 
+build: check-external-libs build-arch build-indep
+
+build-arch: build-arch-stamp
+build-arch-stamp: patch configure-stamp
+
+	[ ! -f Makefile ] || $(MAKE)
+
+build-indep: build-indep-stamp
+build-indep-stamp: patch configure-stamp
+
+	touch $@
+
+clean:	clean-patched unpatch
+
+clean-patched:
+	dh_testdir
+	dh_testroot
+	rm -f build-arch-stamp build-indep-stamp configure-stamp
+	rm -f utils/smnotify/smnotify.h utils/smnotify/gen_smnotify.c
+
+	rm -rf $(DESTDIR)
+	[ ! -f Makefile ] || $(MAKE) distclean
+
+	dh_clean 
+
+install: install-indep install-arch
+install-indep:
+	dh_testdir
+	dh_testroot
+	dh_clean -k -i 
+	dh_installdirs -i
+
+	dh_install -i
+
+install-arch:
+	dh_testdir
+	dh_testroot
+	dh_clean -k -s 
+	dh_installdirs -s
+
+	# Create the target build directory hierarchy
+	mkdir -p $(DESTDIR)/etc/init.d
+	mkdir -p $(DESTDIR)/etc/default
+	$(MAKE) DESTDIR=$(DESTDIR) install
+	install -m644 config/ctdb.sysconfig $(DESTDIR)/etc/default/ctdb
+	dh_install -s
+binary-common:
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	#patch doc
+	sed -i 's|/etc/sysconfig/|/etc/default/|' $(DESTDIR)/usr/share/doc/ctdb/web/*.html
+	#upstream changelog 
+	grep -A 10000 '%changelog' packaging/RPM/ctdb.spec > $(DESTDIR)/usr/share/doc/ctdb/changelog
+	dh_installexamples
+	dh_installlogrotate
+	#install init script
+	DH_OPTIONS= dh_installinit -pctdb --no-start --no-restart-on-upgrade
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress 
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+# Build architecture independant packages using the common target.
+binary-indep: build-indep install-indep
+	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
+
+# Build architecture dependant packages using the common target.
+binary-arch: build-arch install-arch
+	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
+
+binary: binary-arch binary-indep
+
+check-external-libs:
+	if [ -e lib/popt ]; then \
+              echo " *****************************************"; \
+	      echo " **                                     **"; \
+	      echo " **  tar contains external libraries!   **"; \
+	      echo " **                                     **"; \
+              echo " *****************************************"; \
+	      echo "The tarball should be made by using uscan or"; \
+	      echo "debian/uupdate-wrapper"; \
+	      echo ""; \
+	      exit 1; \
+        fi
+
+.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure patch unpatch
--- ctdb-1.0.99.orig/debian/uupdate-wrapper
+++ ctdb-1.0.99/debian/uupdate-wrapper
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+version=$2
+file=$3
+
+#remove git log (only used by uscan)
+rm $file
+#pull source from git
+git clone git://git.samba.org/sahlberg/ctdb.git;h=ctdb-$version
+mv ctdb ctdb-$version.orig
+#clean source
+rm -rf ctdb-$version.orig/.git
+#autogen
+cd ctdb-$version.orig
+./autogen.sh
+cd ..
+#remove included popt
+rm -rf ctdb-$version.orig/lib/popt
+#tar.gz
+tar cfz ctdb_$version.orig.tar.gz ctdb-$version.orig
+#remove orig directory
+rm -rf ctdb-$version.orig
+
--- ctdb-1.0.99.orig/debian/compat
+++ ctdb-1.0.99/debian/compat
@@ -0,0 +1 @@
+5
--- ctdb-1.0.99.orig/debian/ctdb.docs
+++ ctdb-1.0.99/debian/ctdb.docs
@@ -0,0 +1 @@
+web
--- ctdb-1.0.99.orig/debian/changelog
+++ ctdb-1.0.99/debian/changelog
@@ -0,0 +1,236 @@
+ctdb (1.0.99-1~bpo50+1) lenny-backports; urgency=low
+
+  * Rebuild for lenny-backports.
+
+ -- Mathieu Parent <sathieu@debian.org>  Tue, 03 Nov 2009 20:37:28 +0100
+
+ctdb (1.0.99-1) unstable; urgency=low
+
+  * New upstream release
+  * ctdb.init: ported 'move the logging of the warning "No reclock file used"
+    to the startup case so we only print this warning on "service ctdb start"
+    and not for "service ctdb *"' from upstream
+    (commit eb854f65f978f24583e221138eb4f9b917b89285)
+  * Remove XS-DM-Upload-Allowed, as I am now Debian developer
+
+ -- Mathieu Parent <sathieu@debian.org>  Sat, 24 Oct 2009 14:59:19 +0200
+
+ctdb (1.0.92-1) unstable; urgency=low
+
+  * New upstream release, patches integrated :
+    - 30_outdated-autotools.diff 
+    - 50-fix-bashism.diff
+  * Change my email address, as I am now Debian developer 
+  * 50-fix-bashism.diff is back for another bashism in
+    config/events.d/11.natgw
+
+ -- Mathieu Parent <sathieu@debian.org>  Sun, 04 Oct 2009 18:59:32 +0200
+
+ctdb (1.0.88-1) unstable; urgency=low
+
+  * new upstream release
+    - update ctdb.init:
+      + allow starting without a reclock file (1.0.86)
+      + use var $ctdb instead of $DAEMON to match upstream
+      + Move building of CTDB_OPTIONS to new function build_ctdb_options()
+        and have it use a helper function for readability (1.0.87)
+      + New functions check_persistent_databases() and set_ctdb_variables()
+        (1.0.87)
+      + Make it possible to start the daemon in STOPPED mode (1.0.87)
+  * Bump Standards-Version to 3.8.3: no changes
+  * 30_outdated-autotools.diff: Correct outdated config.{sub,guess}
+    (Closes: #536256)
+  * Added "time" to Depends. This remove part of 50-fix-bashism.diff 
+  * Add README.source as required by policy 4.14
+  * Register with doc-base
+
+ -- Mathieu Parent <math.parent@gmail.com>  Thu, 27 Aug 2009 23:14:23 +0200
+
+ctdb (1.0.85-1) unstable; urgency=low
+
+  * new upstream release
+    - update ctdb.init:
+      + obsolete ipmux component removed
+      + Initscript fixes
+      + respects the $CTDBD environment variable
+  * Bump standards version to 3.8.2 (no changes needed) 
+
+ -- Mathieu Parent <math.parent@gmail.com>  Tue, 23 Jun 2009 21:49:50 +0200
+
+ctdb (1.0.82-2) unstable; urgency=low
+
+  * 10_no-lib64.diff updated: Don't Ship files in /usr/lib64 only on amd64
+  * 50-fix-bashism.diff (new): Fix "bashism in /bin/sh script"
+    (Closes: #530064)
+  * lsof in Suggests instead of Depends as it is only used by ctdb_diagnostics
+  * ethtool in Recommends instead of Depends as it is only used by
+    /etc/ctdb/events.d/10.interface
+  * GNU Hurd support: Closes: #530413
+    - Build-Depends on libpcap-dev [hurd-i386]
+    - Depends on iproute [!hurd-i386]
+    - 05-hurd.diff: fix configure script and support Hurd
+    - thanks to Marc Dequènes (Duck)
+
+ -- Mathieu Parent <math.parent@gmail.com>  Sun, 31 May 2009 18:02:41 +0200
+
+ctdb (1.0.82-1) unstable; urgency=low
+
+  * new upstream release
+  * 10_no-lib64.diff (new): Don't Ship files in /usr/lib64 (Closes: #528976)
+
+ -- Mathieu Parent <math.parent@gmail.com>  Sun, 17 May 2009 16:59:36 +0200
+
+ctdb (1.0.80-1) unstable; urgency=low
+
+  * new upstream release
+    - 30_install_notify.sh_executable.diff included (this is upstream bug
+      https://bugzilla.samba.org/show_bug.cgi?id=6250) in 1.0.79
+    - pkg-config shipped (Closes: #503209)
+
+ -- Mathieu Parent <math.parent@gmail.com>  Wed, 06 May 2009 16:49:02 +0200
+
+ctdb (1.0.78-1) unstable; urgency=low
+
+  * new upstream release
+    - updated 02_ctdb_diagnostics.diff
+    - updated ctdb.init (from 1.0.75 and 1.0.78)
+  * fix debian/uupdate-wrapper to use "git clone" instead of "git-clone"
+  * Updated Standards-Version to 3.8.1: no changes 
+  * ctdb.init: update as in https://bugzilla.samba.org/show_bug.cgi?id=6225
+    - Default-Stop: 0 1 6
+    - renamed functions: start -> start_server, stop -> stop_server
+  * debian/copyright: adding Michael Adam to upstream authors 
+  * added 30_install_notify.sh_executable.diff: to install /etc/ctdb/notify.sh
+    as executable (it is a shell script)
+
+ -- Mathieu Parent <math.parent@gmail.com>  Tue, 07 Apr 2009 19:24:10 +0200
+
+ctdb (1.0.73-1) unstable; urgency=low
+
+  * new upstream release
+    - most patches integrated. Thanks to Michael Adam.
+    - 06_services_names.diff: removed, distribution specific service names are
+      now known by scripts (samba, apache2) 
+    - 25_popt_lib.diff: removed, integrated 
+    - 30_ctdb_log.diff: removed, integrated (with some changes)
+    - debian/rules: use --with-logdir instead of --logdir
+    - 50_ctdbd_manpage_warning.diff: removed, integrated 
+  * remove obsolete debian/README.build
+
+ -- Mathieu Parent <math.parent@gmail.com>  Fri, 06 Mar 2009 21:08:01 +0100
+
+ctdb (1.0.71-2) unstable; urgency=low
+
+  * upload to unstable 
+
+ -- Mathieu Parent <math.parent@gmail.com>  Mon, 16 Feb 2009 20:27:04 +0100
+
+ctdb (1.0.71-1) experimental; urgency=low
+
+  * new upstream version
+    - from 1.0.71: 06_services_names.diff: samba patch not needed anymore
+  * updated debian/watch
+  * debian/copyright: updated, corrects lintian warning:
+    copyright-with-old-dh-make-debian-copyright
+  * 50_ctdbd_manpage_warning.diff: correct ctdbd(1) manpage warning
+  * debian/rules: install upstream changelog (taken from specfile) 
+  * debian/copyright: refers to versionned license version
+  * Updated init script to better match upstream's one
+
+ -- Mathieu Parent <math.parent@gmail.com>  Tue, 03 Feb 2009 19:10:04 +0100
+
+ctdb (1.0.65-1) experimental; urgency=low
+
+  * New upstream git version
+    - from 1.0.63: make it possible to set the script log level in CTDB
+      sysconfig
+    - from 1.0.65: default debug level is 2 (NOTICE) and not 0 (ERROR)
+  * Maintenance enhancements:
+    * Added debian/watch, which points to latest sahlberg's version
+    * Added debian/uupdate-wrapper, called by uscan for new upstream version
+    * debian/rules: removed get-orig-source target in favour of uscan
+    * removed debian/build-orig (was used by get-orig-source target)
+  * Updated init script to better match upstream's one
+  * 02_ctdb_diagnostics.diff: 
+    - keep rpm queries
+    - part concerning dpkg has been integrated upstream
+  * refreshed all patches
+  * 30_ctdb_log.diff: updated to prepare upstream inclusion
+  * debian/rules: added check-external-libs to check orig tarball for popt 
+  * 02_ctdb_diagnostics.diff partially applied upstream (from 1.60)
+
+ -- Mathieu Parent <math.parent@gmail.com>  Sat, 15 Nov 2008 16:31:49 +0100
+
+ctdb (1.0.47+git200807111148-1) unstable; urgency=low
+
+  * New upstream git snapshot
+    * From 1.0.43: added CTDB_VALGRIND option to ctdb.init
+    * From 1.0.46: new option CTDB_SAMBA_SKIP_SHARE_CHECK
+    * From 1.0.46: make LVS a capability so that we can see which nodes are 
+      configured with LVS and which are not using LVS
+    * From 1.0.47: Complete rewrite of onnode: Remove manpage links
+  * Bump standards version to 3.8.0 (no changes needed)
+  * Remove patch 04_install_chmod, applied upstream
+    (see https://bugzilla.samba.org/show_bug.cgi?id=5216)
+  * Remove ctdb.TODO: was only containing lintian warnings
+
+ -- Mathieu Parent <math.parent@gmail.com>  Fri, 11 Jul 2008 22:08:16 +0200
+
+ctdb (1.0.42+git200806131353-1) unstable; urgency=low
+
+  * New upstream git snapshot
+  * From 1.0.35: Add ability to disable recmaster and lmaster roles through
+    sysconfig file and command line arguments
+  * From 1.0.38: Use tdbdump to verify that all persistent database files are
+    good before we start the daemon.
+  * Added symlinks from onnode manpage to onnode.rsh and onnode.ssh ones:
+    remove two lintian warnings
+  * Fixed bashism in /etc/init.d/ctdb script, we don't use the suggested patch
+    as we don't want to depend on gettext (Closes: #486027).
+  * use svn-buildpackage (upstream tarball is now in svn) 
+
+ -- Mathieu Parent <math.parent@gmail.com>  Sat, 14 Jun 2008 12:33:25 +0200
+
+ctdb (1.0.34+git200804242206-1) unstable; urgency=low
+
+  * New upstream git snapshot
+  * added CTDB_START_AS_DISABLED parameter to ctdb.init
+  * removed 03_web.diff, replaced by sed replaces in debian/rules 
+
+ -- Mathieu Parent <math.parent@gmail.com>  Mon, 12 May 2008 22:58:07 +0200
+
+ctdb (1.0.31+git200803251111-1) unstable; urgency=low
+
+  * new upstream git snapshot, from git://git.samba.org/sahlberg/ctdb.git
+  * changed maintener name to CamelCase
+
+ -- Mathieu Parent <math.parent@gmail.com>  Wed, 26 Mar 2008 19:15:44 +0100
+
+ctdb (1.0.28+git200802191444-1) unstable; urgency=low
+
+  * new upstream git snapshot
+  * dropped 05_nice_service.diff, merged upstream
+  * updated 04_install_chmod.patch, half has been merged upstream
+  * updated 06_services_names, nfs is not patched anymore
+  * new patch 30_ctdb_log (thanks to danp)
+  * fixed missing copyright
+  ** remove popt from upstream tarball (changing get-orig-source target)
+  ** added 25_popt_lib to build with system popt lib
+  ** completed copyright file
+
+ -- Mathieu Parent <math.parent@gmail.com>  Wed, 13 Feb 2008 21:43:33 +0100
+
+ctdb (1.0.28+git200802081512-1) unstable; urgency=low
+
+  * Initial release (Closes: #460114)
+  * 02_ctdb_diagnostics.diff: adapt ctdb_diagnostics to debian
+  * 03_web.diff: correct various paths in documentation
+  * 04_install_chmod.patch: correct Makefile to install proper execution 
+    permissions
+  * 05_nice_service.diff: create a nice_service function
+  * 06_services_names.diff: correct services names 
+  * init script with start/stop/status
+  * logrotate for /var/log/log.ctdb
+
+ -- Mathieu Parent <math.parent@gmail.com>  Tue, 15 Jan 2008 23:16:44 +0100
+
--- ctdb-1.0.99.orig/debian/ctdb.doc-base
+++ ctdb-1.0.99/debian/ctdb.doc-base
@@ -0,0 +1,7 @@
+Document: ctdb-web
+Title: CTDB website
+Section: Network/File Transfer
+
+Format: HTML
+Index: /usr/share/doc/ctdb/web/index.html
+Files: /usr/share/doc/ctdb/web/*
--- ctdb-1.0.99.orig/debian/control
+++ ctdb-1.0.99/debian/control
@@ -0,0 +1,43 @@
+Source: ctdb
+Section: net
+Priority: extra
+Maintainer: Debian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
+Uploaders: Mathieu Parent <sathieu@debian.org>
+Build-Depends: debhelper (>= 5), quilt (>= 0.40), libpopt-dev, libpcap-dev [hurd-i386]
+Homepage: http://ctdb.samba.org/
+Standards-Version: 3.8.3
+Vcs-Svn: svn://svn.debian.org/pkg-samba/trunk/ctdb/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-samba/trunk/ctdb/
+
+Package: ctdb
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base, iproute [!hurd-i386], psmisc, tdb-tools, time
+Recommends: ethtool
+Suggests: logrotate, lsof
+Description: clustered database to store temporary data
+ CTDB is a cluster implementation of the TDB database used by Samba and other
+ projects to store temporary data. If an application is already using TDB for
+ temporary data it is very easy to convert that application to be cluster aware 
+ and use CTDB instead.
+ .
+ CTDB provides the same types of functions as TDB but in a clustered fashion, 
+ providing a TDB-style database that spans multiple physical hosts in a cluster.
+ .
+ Features include:
+  * CTDB provides a TDB that has consistent data and consistent locking across 
+    all nodes in a cluster.
+  * CTDB is very fast.
+  * In case of node failures, CTDB will automatically recover and repair all TDB
+    databases that it manages.
+  * CTDB is the core component that provides pCIFS ("parallel CIFS") with 
+    Samba3/4.
+  * CTDB provides HA features such as node monitoring, node failover, and IP 
+    takeover.
+  * CTDB provides a reliable messaging transport to allow applications linked 
+    with CTDB to communicate to other instances of the application running on
+    different nodes in the cluster.
+  * CTDB has pluggable transport backends. Currently implemented backends are 
+    TCP and Infiniband.
+  * CTDB supports a system of application specific management scripts, allowing
+    applications that depend on network or filesystem resources to be managed in
+    a highly available manner on a cluster. 
--- ctdb-1.0.99.orig/debian/ctdb.logrotate
+++ ctdb-1.0.99/debian/ctdb.logrotate
@@ -0,0 +1,8 @@
+/var/log/log.ctdb {
+	weekly
+	missingok
+	rotate 7
+	copytruncate
+	compress
+	notifempty
+}
--- ctdb-1.0.99.orig/debian/watch
+++ ctdb-1.0.99/debian/watch
@@ -0,0 +1,5 @@
+version=3
+opts=filenamemangle=s/^.*ctdb-([\d\.]+)/ctdb-$1/ \
+http://git.samba.org/?p=sahlberg/ctdb.git;a=tags \
+/\?p=sahlberg/ctdb.git;a=shortlog;h=refs/tags/ctdb-([\d\.]+) \
+debian debian/uupdate-wrapper
--- ctdb-1.0.99.orig/debian/copyright
+++ ctdb-1.0.99/debian/copyright
@@ -0,0 +1,122 @@
+This package was debianized by:
+
+    Mathieu Parent <math.parent@gmail.com> on Tue, 15 Jan 2008 23:43:47 +0100.
+
+It was downloaded from:
+
+    <http://ctdb.samba.org/>
+
+Upstream Authors: 
+
+    Andrew Tridgell
+    Ronnie Sahlberg
+    Michael Adam
+    Peter Somogyi
+    Volker Lendecke
+
+Copyright:
+
+    Copyright (C) Andrew Tridgell 2006-2008
+    Copyright (C) Ronnie sahlberg 2007
+
+License:
+
+    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 3 of the License, or (at
+    your option) any later version.
+    
+    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, see http://www.gnu.org/licenses/.
+
+The Debian packaging is:
+
+    Copyright (C) 2008-2009, Mathieu Parent <math.parent@gmail.com>
+
+and is licensed under the GPL version 3 or (at your option) any later version,
+see above.
+
+===============================================================================
+This package also include the following libraries :
+
+In the following text, GPL3+ refers to :
+    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 3 of the License, or (at
+    your option) any later version.
+    
+    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, see http://www.gnu.org/licenses/.
+
+On Debian systems, the complete text of the GNU General Public License
+version 3 can be found in `/usr/share/common-licenses/GPL-3'.
+
+In the following text, LGPL3+ refers to :
+   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 3 of the License, or
+   (at your option) any later version.
+   
+   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, see <http://www.gnu.org/licenses/>.
+
+On Debian systems, the complete text of the GNU Lesser General Public License
+version 3 can be found in `/usr/share/common-licenses/LGPL-3'.
+
+-------------------------------------------------------------------------------
+- lib/events/: GPL3+
+-- (C) Andrew Tridgell 2003-2007
+-- (C) Stefan Metzmacher 2005
+
+-------------------------------------------------------------------------------
+- lib/replace/: LGPL3+
+-- (C) The Regents of the University of California 1994
+-- (C) The PostgreSQL Global Development Group 1996-2007
+-- (C) Andrew Tridgell 1992-1998,2004,2005,2006
+-- (C) Kungliga Tekniska Högskolan 1997
+-- (C) Jelmer Vernooij 2006-2007
+-- (C) Jeremy Allison 1998-2002,2007
+-- (C) Internet Software Consortium 1996-2001
+-- (C) Patrick Powell 1995
+-- (C) Free Software Foundation, Inc. 1992-2000
+
+-------------------------------------------------------------------------------
+- lib/talloc/ : LGPL3+ 
+-- (C) Andrew Tridgell 2004-2005
+-- (C) Stefan Metzmacher 2006
+
+-------------------------------------------------------------------------------
+- lib/tdb/ is LGPL3+ ;
+-- (C) Andrew Tridgell 1999-2005
+-- (C) Paul `Rusty' Russell 2000
+-- (C) Jeremy Allison 2000-2006
+-- (C) Andrew Esh 2001
+-- (C) Tim Potter 2004-2006
+
+-------------------------------------------------------------------------------
+- lib/util/: GPL3+
+-- (C) Volker Lendecke 2007
+-- (C) Concurrent Computer Corporation 2002
+-- (C) Andrew Tridgell 1998,2004-2005
+-- (C) Jelmer Vernooij 2005
+
+-------------------------------------------------------------------------------
+- ib/: GPL3+
+-- (C) Sven Oehme <oehmes@de.ibm.com> 2006
+-- (C) Peter Somogyi <psomogyi@gamax.hu>
+
--- ctdb-1.0.99.orig/debian/ctdb.init
+++ ctdb-1.0.99/debian/ctdb.init
@@ -0,0 +1,360 @@
+#!/bin/sh
+#
+##############################
+# ctdb:                        Starts the clustered tdb daemon
+#
+# chkconfig:           - 90 36
+#
+# description:                 Starts and stops the clustered tdb daemon
+# pidfile:             /var/run/ctdbd/ctdbd.pid
+#
+
+### BEGIN INIT INFO
+# Provides:          ctdb
+# Required-Start:    $network $local_fs $remote_fs
+# Required-Stop:     $network $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: start and stop ctdb service
+# Description:       initscript for the ctdb service
+### END INIT INFO
+
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+NAME=ctdb
+DESC="Clustered TDB"
+
+#LSB
+if [ -f /lib/lsb/init-functions ] ; then
+  . /lib/lsb/init-functions
+fi
+if ! type 'log_daemon_msg' >/dev/null; then
+    log_daemon_msg () {
+        if [ -z "${1:-}" ]; then
+            return 1
+        fi
+
+        if [ -z "${2:-}" ]; then
+            echo -n "$1:"
+            return
+        fi
+        
+        echo -n "$1: $2"
+    }
+fi
+if ! type 'log_progress_msg' >/dev/null; then
+    log_progress_msg () {
+        if [ -z "${1:-}" ]; then
+            return 1
+        fi
+        echo -n " $@"
+    }
+fi
+if ! type 'log_end_msg' >/dev/null; then
+    log_end_msg () {
+        # If no arguments were passed, return
+        if [ -z "${1:-}" ]; then
+            return 1
+        fi
+
+        retval=$1
+
+        if [ $1 -eq 0 ]; then
+            echo "."
+        elif [ $1 -eq 255 ]; then
+            /bin/echo -e " (warning)."
+        else
+            /bin/echo -e " failed!"
+        fi
+        return $retval
+    }
+fi
+
+# Source function library.
+if [ -f /etc/init.d/functions ] ; then
+    . /etc/init.d/functions
+elif [ -f /etc/rc.d/init.d/functions ] ; then
+    . /etc/rc.d/init.d/functions
+fi
+
+#gettext
+if [ -f /usr/bin/gettext.sh ] ; then
+    . /usr/bin/gettext.sh
+fi
+if ! type 'eval_gettext' >/dev/null; then
+    eval_gettext() {
+        echo -n "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
+    }
+fi
+
+[ -f /etc/rc.status ] && {
+    . /etc/rc.status
+    rc_reset
+    LC_ALL=en_US.UTF-8
+}
+
+# Avoid using root's TMPDIR
+unset TMPDIR
+
+[ -z "$CTDB_BASE" ] && {
+    export CTDB_BASE="/etc/ctdb"
+}
+
+. $CTDB_BASE/functions
+loadconfig network
+loadconfig ctdb
+
+set -e
+
+# check networking is up (for redhat)
+[ "$NETWORKING" = "no" ] && exit 0
+
+detect_init_style
+export CTDB_INIT_STYLE
+
+ctdbd=${CTDBD:-/usr/sbin/ctdbd}
+
+test -x $ctdbd || exit 0
+
+if [ "$CTDB_VALGRIND" = "yes" ]; then
+    init_style="valgrind"
+else
+    init_style="$CTDB_INIT_STYLE"
+fi
+
+build_ctdb_options () {
+    [ -z "$CTDB_RECOVERY_LOCK" ] && {
+        echo "You must configure the location of the CTDB_RECOVERY_LOCK"
+        exit 1
+    }
+
+    maybe_set () {
+        # If the 2nd arg is null then return - don't set anything.
+        # Else if the 3rd arg is set and it doesn't match the 2nd arg
+        # then return
+        [ -z "$2" -o \( -n "$3" -a "$3" != "$2" \) ] && return
+
+        val="$2"
+        case "$1" in
+            --*) sep="=" ;;
+            -*)  sep=" " ;;
+        esac
+        # For these options we're only passing a value-less flag.
+        [ -n "$3" ] && {
+            val=""
+            sep=""
+        }
+
+        CTDB_OPTIONS="${CTDB_OPTIONS}${CTDB_OPTIONS:+ }${1}${sep}${val}"
+    }
+
+    [ -z "$CTDB_RECOVERY_LOCK" ] && {
+        echo "No recovery lock specified. Starting CTDB without split brain prevention"
+    }
+    maybe_set "--reclock"                "$CTDB_RECOVERY_LOCK"
+
+    # build up CTDB_OPTIONS variable from optional parameters
+    maybe_set "--logfile"                "$CTDB_LOGFILE"
+    maybe_set "--nlist"                  "$CTDB_NODES"
+    maybe_set "--socket"                 "$CTDB_SOCKET"
+    maybe_set "--public-addresses"       "$CTDB_PUBLIC_ADDRESSES"
+    maybe_set "--public-interface"       "$CTDB_PUBLIC_INTERFACE"
+    maybe_set "--dbdir"                  "$CTDB_DBDIR"
+    maybe_set "--dbdir-persistent"       "$CTDB_DBDIR_PERSISTENT"
+    maybe_set "--event-script-dir"       "$CTDB_EVENT_SCRIPT_DIR"
+    maybe_set "--transport"              "$CTDB_TRANSPORT"
+    maybe_set "-d"                       "$CTDB_DEBUGLEVEL"
+    maybe_set "--notification-script"    "$CTDB_NOTIFY_SCRIPT"
+    maybe_set "--start-as-disabled"      "$CTDB_START_AS_DISABLED"    "yes"
+    maybe_set "--start-as-stopped "      "$CTDB_START_AS_STOPPED"     "yes"
+    maybe_set "--no-recmaster"           "$CTDB_CAPABILITY_RECMASTER" "no"
+    maybe_set "--no-lmaster"             "$CTDB_CAPABILITY_LMASTER"   "no"
+    maybe_set "--lvs --single-public-ip" "$CTDB_LVS_PUBLIC_IP"
+    maybe_set "--script-log-level"       "$CTDB_SCRIPT_LOG_LEVEL"
+}
+
+check_persistent_databases () {
+    case $init_style in
+        ubuntu) PERSISTENT_DB_DIR="${CTDB_DBDIR:-/var/lib/ctdb}/persistent" ;;
+        *) PERSISTENT_DB_DIR="${CTDB_DBDIR:-/var/ctdb}/persistent" ;;
+    esac
+    mkdir -p $PERSISTENT_DB_DIR 2>/dev/null
+    for PDBASE in `ls $PERSISTENT_DB_DIR/*.tdb.[0-9] 2>/dev/null`; do
+        /usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
+        echo "Persistent database $PDBASE is corrupted! CTDB will not start."
+        return 1
+    }
+    done
+}
+
+set_ctdb_variables () {
+    # set any tunables from the config file
+    set | grep ^CTDB_SET_ | cut -d_ -f3- | 
+    while read v; do
+        varname=`echo $v | cut -d= -f1`
+        value=`echo $v | cut -d= -f2`
+        ctdb setvar $varname $value || RETVAL=1
+    done || exit 1
+}
+
+set_retval() {
+    return $1
+}
+
+running() {
+    pkill -0 -f $ctdbd || return 1
+    return 0
+}
+
+start_server() {
+    build_ctdb_options
+
+    check_persistent_databases || return $?
+
+    case $init_style in
+        valgrind)
+	        valgrind -q --log-file=/var/log/ctdb_valgrind \
+	            $ctdbd --nosetsched $CTDB_OPTIONS 
+	        RETVAL=$?
+	        echo
+	    ;;
+        suse)
+	        startproc $ctdbd $CTDB_OPTIONS
+	        rc_status -v
+	        RETVAL=$?
+	    ;;
+        redhat)
+	        daemon $ctdbd $CTDB_OPTIONS
+	        RETVAL=$?
+	        echo
+	        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
+	    ;;
+        ubuntu)
+	        start-stop-daemon --start --quiet --background \
+	            --exec $ctdbd -- $CTDB_OPTIONS
+	        RETVAL=$?
+	    ;;
+    esac
+
+    sleep 1
+
+    set_ctdb_variables
+
+    return $RETVAL
+}	
+
+stop_server() {
+    ctdb shutdown >/dev/null 2>&1
+    RETVAL=$?
+    count=0
+    if [ "$init_style" = "ubuntu" ]; then
+        start-stop-daemon --stop --quiet --exec $ctdbd
+        RETVAL=$?
+    fi
+    while pkill -0 -f $ctdbd ; do
+        sleep 1
+        count=`expr $count + 1`
+        [ $count -gt 10 ] && {
+	        eval_gettext "killing ctdbd "
+	        pkill -9 -f $ctdbd
+	        pkill -9 -f $CTDB_BASE/events.d/
+        }
+    done
+    case $init_style in
+        suse)
+	        # re-set the return code to the recorded RETVAL in order
+	        # to print the correct status message
+	        set_retval $RETVAL
+	        rc_status -v
+	    ;;
+        redhat)
+	        [ $RETVAL -eq 0 ] && success || failure
+	        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ctdb
+	        echo ""
+	    ;;
+    esac
+    return $RETVAL
+}	
+
+case "$1" in
+    start)
+        log_daemon_msg "Starting $DESC " "$NAME"
+        # Check if it's running first
+        if running ;  then
+            log_progress_msg "already running"
+            log_end_msg 0
+            exit 0
+        fi
+        if start_server && running ;  then
+            # It's ok, the server started and is running
+            log_end_msg 0
+        else
+            # Either we could not start it or it is not running
+            # after we did
+            log_end_msg 1
+        fi
+        ;;
+    stop)
+        log_daemon_msg "Stopping $DESC" "$NAME"
+        if running ; then
+            # Only stop the server if we see it running
+            stop_server
+            log_end_msg $?
+        else
+            # If it's not running don't do anything
+            log_progress_msg "not running"
+            log_end_msg 0
+            exit 0
+        fi
+        ;;
+    restart|reload|force-reload)
+        log_daemon_msg "Restarting $DESC" "$NAME"
+        running && stop_server
+        start_server
+        running
+        log_end_msg $?
+        ;;
+    status)
+        log_daemon_msg "Checking status of $DESC" "$NAME"
+        if running ;  then
+            log_progress_msg "running"
+            echo
+            ctdb status
+            log_end_msg 0
+        else
+            log_progress_msg "not running"
+            log_end_msg 1
+            exit 1
+        fi
+ 	    ;;
+    condrestart)
+        if running ;  then
+            log_daemon_msg "Restarting $DESC" "$NAME"
+            stop_server
+            start_server
+            log_end_msg $?
+        fi
+        ;;
+    cron)
+        # used from cron to auto-restart ctdb
+        if ! running ; then
+            log_daemon_msg "Starting $DESC " "$NAME"
+            if start_server && running ;  then
+                # It's ok, the server started and is running
+                log_end_msg 0
+            else
+                # Either we could not start it or it is not running
+                # after we did
+                log_end_msg 1
+            fi
+        fi
+        ;;
+    *)
+        eval_gettext "Usage: $0 {start|stop|restart|status|cron|condrestart}" >&2
+        echo >&2
+        exit 1
+        ;;
+esac
+
+exit $?
--- ctdb-1.0.99.orig/debian/svn-deblayout
+++ ctdb-1.0.99/debian/svn-deblayout
@@ -0,0 +1,3 @@
+origDir=../ctdb-upstream
+buildArea=../../build-area
+
--- ctdb-1.0.99.orig/debian/README.source
+++ ctdb-1.0.99/debian/README.source
@@ -0,0 +1,9 @@
+This package uses quilt to manage all modifications to the upstream
+source.  Changes are stored in the source package as diffs in
+debian/patches and applied during the build.  Please see:
+
+    /usr/share/doc/quilt/README.source
+
+for more information on how to apply the patches, modify patches, or
+remove a patch.
+
--- ctdb-1.0.99.orig/debian/patches/series
+++ ctdb-1.0.99/debian/patches/series
@@ -0,0 +1,4 @@
+02_ctdb_diagnostics.diff
+05-hurd.diff
+10_no-lib64.diff
+50-fix-bashism.diff
--- ctdb-1.0.99.orig/debian/patches/05-hurd.diff
+++ ctdb-1.0.99/debian/patches/05-hurd.diff
@@ -0,0 +1,434 @@
+Goal: GNU Hurd port
+
+Author: Marc Dequènes (Duck) <duck@duckcorp.org>
+
+Upstream status: TODO
+
+Index: ctdb-1.0.82/configure
+===================================================================
+--- ctdb-1.0.82.orig/configure	2009-05-24 17:51:12.000000000 +0200
++++ ctdb-1.0.82/configure	2009-05-24 18:19:57.000000000 +0200
+@@ -1865,6 +1865,11 @@
+     CTDB_SCSI_IO=
+     CTDB_PCAP_LDFLAGS=-lpcap
+     ;;
++  GNU*)
++    CTDB_SYSTEM_OBJ=common/system_gnu.o
++    CTDB_SCSI_IO=
++    CTDB_PCAP_LDFLAGS=-lpcap
++    ;;
+   *)
+     echo unknown system  cant configure
+     exit
+Index: ctdb-1.0.82/configure.ac
+===================================================================
+--- ctdb-1.0.82.orig/configure.ac	2009-05-24 17:50:47.000000000 +0200
++++ ctdb-1.0.82/configure.ac	2009-05-24 18:19:50.000000000 +0200
+@@ -36,6 +36,11 @@
+     CTDB_SCSI_IO=
+     CTDB_PCAP_LDFLAGS=-lpcap
+     ;;
++  GNU*)
++    CTDB_SYSTEM_OBJ=common/system_gnu.o
++    CTDB_SCSI_IO=
++    CTDB_PCAP_LDFLAGS=-lpcap
++    ;;
+   *)
+     echo unknown system  cant configure
+     exit
+Index: ctdb-1.0.82/server/ctdb_daemon.c
+===================================================================
+--- ctdb-1.0.82.orig/server/ctdb_daemon.c	2009-05-24 17:50:48.000000000 +0200
++++ ctdb-1.0.82/server/ctdb_daemon.c	2009-05-24 17:51:12.000000000 +0200
+@@ -532,6 +532,7 @@
+ 	int fd;
+ 	struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
+ 	struct ctdb_client *client;
++#if ! defined(__GNU__)
+ #ifdef _AIX
+ 	struct peercred_struct cr;
+ 	socklen_t crl = sizeof(struct peercred_struct);
+@@ -539,6 +540,7 @@
+ 	struct ucred cr;
+ 	socklen_t crl = sizeof(struct ucred);
+ #endif
++#endif
+ 
+ 	memset(&addr, 0, sizeof(addr));
+ 	len = sizeof(addr);
+@@ -551,6 +553,7 @@
+ 	set_close_on_exec(fd);
+ 
+ 	client = talloc_zero(ctdb, struct ctdb_client);
++#if ! defined(__GNU__)
+ #ifdef _AIX
+ 	if (getsockopt(fd, SOL_SOCKET, SO_PEERID, &cr, &crl) == 0) {
+ #else
+@@ -558,6 +561,7 @@
+ #endif
+ 		talloc_asprintf(client, "struct ctdb_client: pid:%u", (unsigned)cr.pid);
+ 	}
++#endif
+ 
+ 	client->ctdb = ctdb;
+ 	client->fd = fd;
+Index: ctdb-1.0.82/common/system_gnu.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ ctdb-1.0.82/common/system_gnu.c	2009-05-24 18:18:47.000000000 +0200
+@@ -0,0 +1,355 @@
++/* 
++   ctdb system specific code to manage raw sockets on linux
++
++   Copyright (C) Ronnie Sahlberg  2007
++   Copyright (C) Andrew Tridgell  2007
++   Copyright (C) Marc Dequènes (Duck) 2009
++
++   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 3 of the License, or
++   (at your option) any later version.
++   
++   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, see <http://www.gnu.org/licenses/>.
++
++
++  This file is a copy of 'common/system_linux.c' adapted for Hurd needs,
++  and inspired by 'common/system_aix.c' for the pcap usage.
++*/
++
++#include "includes.h"
++#include "system/network.h"
++#include "system/filesys.h"
++#include "system/wait.h"
++#include "../include/ctdb_private.h"
++#include "lib/events/events.h"
++#include <net/ethernet.h>
++#include <netinet/ip6.h>
++#include <net/if_arp.h>
++#include <pcap.h>
++
++
++#ifndef ETHERTYPE_IP6
++#define ETHERTYPE_IP6 0x86dd
++#endif
++
++/*
++  calculate the tcp checksum for tcp over ipv6
++*/
++static uint16_t tcp_checksum6(uint16_t *data, size_t n, struct ip6_hdr *ip6)
++{
++	uint32_t phdr[2];
++	uint32_t sum = 0;
++	uint16_t sum2;
++
++	sum += uint16_checksum((uint16_t *)(void *)&ip6->ip6_src, 16);
++	sum += uint16_checksum((uint16_t *)(void *)&ip6->ip6_dst, 16);
++
++	phdr[0] = htonl(n);
++	phdr[1] = htonl(ip6->ip6_nxt);
++	sum += uint16_checksum((uint16_t *)phdr, 8);
++
++	sum += uint16_checksum(data, n);
++
++	sum = (sum & 0xFFFF) + (sum >> 16);
++	sum = (sum & 0xFFFF) + (sum >> 16);
++	sum2 = htons(sum);
++	sum2 = ~sum2;
++	if (sum2 == 0) {
++		return 0xFFFF;
++	}
++	return sum2;
++}
++
++/*
++  send gratuitous arp reply after we have taken over an ip address
++
++  saddr is the address we are trying to claim
++  iface is the interface name we will be using to claim the address
++ */
++int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
++{
++	/* We dont do grat arp on Hurd yet */
++	return 0;
++}
++
++
++/*
++  simple TCP checksum - assumes data is multiple of 2 bytes long
++ */
++static uint16_t tcp_checksum(uint16_t *data, size_t n, struct iphdr *ip)
++{
++	uint32_t sum = uint16_checksum(data, n);
++	uint16_t sum2;
++	sum += uint16_checksum((uint16_t *)(void *)&ip->saddr,
++			       sizeof(ip->saddr));
++	sum += uint16_checksum((uint16_t *)(void *)&ip->daddr,
++			       sizeof(ip->daddr));
++	sum += ip->protocol + n;
++	sum = (sum & 0xFFFF) + (sum >> 16);
++	sum = (sum & 0xFFFF) + (sum >> 16);
++	sum2 = htons(sum);
++	sum2 = ~sum2;
++	if (sum2 == 0) {
++		return 0xFFFF;
++	}
++	return sum2;
++}
++
++/*
++  Send tcp segment from the specified IP/port to the specified
++  destination IP/port. 
++
++  This is used to trigger the receiving host into sending its own ACK,
++  which should trigger early detection of TCP reset by the client
++  after IP takeover
++
++  This can also be used to send RST segments (if rst is true) and also
++  if correct seq and ack numbers are provided.
++ */
++int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, 
++		      const ctdb_sock_addr *src,
++		      uint32_t seq, uint32_t ack, int rst)
++{
++	int s;
++	int ret;
++	uint32_t one = 1;
++	uint16_t tmpport;
++	ctdb_sock_addr *tmpdest;
++	struct {
++		struct iphdr ip;
++		struct tcphdr tcp;
++	} ip4pkt;
++	struct {
++		struct ip6_hdr ip6;
++		struct tcphdr tcp;
++	} ip6pkt;
++
++	switch (src->ip.sin_family) {
++	case AF_INET:
++		ZERO_STRUCT(ip4pkt);
++		ip4pkt.ip.version  = 4;
++		ip4pkt.ip.ihl      = sizeof(ip4pkt.ip)/4;
++		ip4pkt.ip.tot_len  = htons(sizeof(ip4pkt));
++		ip4pkt.ip.ttl      = 255;
++		ip4pkt.ip.protocol = IPPROTO_TCP;
++		ip4pkt.ip.saddr    = src->ip.sin_addr.s_addr;
++		ip4pkt.ip.daddr    = dest->ip.sin_addr.s_addr;
++		ip4pkt.ip.check    = 0;
++
++		ip4pkt.tcp.source   = src->ip.sin_port;
++		ip4pkt.tcp.dest     = dest->ip.sin_port;
++		ip4pkt.tcp.seq      = seq;
++		ip4pkt.tcp.ack_seq  = ack;
++		ip4pkt.tcp.ack      = 1;
++		if (rst) {
++			ip4pkt.tcp.rst      = 1;
++		}
++		ip4pkt.tcp.doff     = sizeof(ip4pkt.tcp)/4;
++		/* this makes it easier to spot in a sniffer */
++		ip4pkt.tcp.window   = htons(1234);
++		ip4pkt.tcp.check    = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip);
++
++		/* open a raw socket to send this segment from */
++		s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
++		if (s == -1) {
++			DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket (%s)\n",
++				 strerror(errno)));
++			return -1;
++		}
++
++		ret = setsockopt(s, IPPROTO_IP, IP_HDRINCL, &one, sizeof(one));
++		if (ret != 0) {
++			DEBUG(DEBUG_CRIT,(__location__ " failed to setup IP headers (%s)\n",
++				 strerror(errno)));
++			close(s);
++			return -1;
++		}
++
++		set_nonblocking(s);
++		set_close_on_exec(s);
++
++		ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, &dest->ip, sizeof(dest->ip));
++		close(s);
++		if (ret != sizeof(ip4pkt)) {
++			DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
++			return -1;
++		}
++		break;
++	case AF_INET6:
++		ZERO_STRUCT(ip6pkt);
++		ip6pkt.ip6.ip6_vfc  = 0x60;
++		ip6pkt.ip6.ip6_plen = htons(20);
++		ip6pkt.ip6.ip6_nxt  = IPPROTO_TCP;
++		ip6pkt.ip6.ip6_hlim = 64;
++		ip6pkt.ip6.ip6_src  = src->ip6.sin6_addr;
++		ip6pkt.ip6.ip6_dst  = dest->ip6.sin6_addr;
++
++		ip6pkt.tcp.source   = src->ip6.sin6_port;
++		ip6pkt.tcp.dest     = dest->ip6.sin6_port;
++		ip6pkt.tcp.seq      = seq;
++		ip6pkt.tcp.ack_seq  = ack;
++		ip6pkt.tcp.ack      = 1;
++		if (rst) {
++			ip6pkt.tcp.rst      = 1;
++		}
++		ip6pkt.tcp.doff     = sizeof(ip6pkt.tcp)/4;
++		/* this makes it easier to spot in a sniffer */
++		ip6pkt.tcp.window   = htons(1234);
++		ip6pkt.tcp.check    = tcp_checksum6((uint16_t *)&ip6pkt.tcp, sizeof(ip6pkt.tcp), &ip6pkt.ip6);
++
++		s = socket(PF_INET6, SOCK_RAW, IPPROTO_RAW);
++		if (s == -1) {
++			DEBUG(DEBUG_CRIT, (__location__ " Failed to open sending socket\n"));
++			return -1;
++
++		}
++		/* sendto() dont like if the port is set and the socket is
++		   in raw mode.
++		*/
++		tmpdest = discard_const(dest);
++		tmpport = tmpdest->ip6.sin6_port;
++
++		tmpdest->ip6.sin6_port = 0;
++		ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, &dest->ip6, sizeof(dest->ip6));
++		tmpdest->ip6.sin6_port = tmpport;
++		close(s);
++
++		if (ret != sizeof(ip6pkt)) {
++			DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno)));
++			return -1;
++		}
++		break;
++
++	default:
++		DEBUG(DEBUG_CRIT,(__location__ " not an ipv4/v6 address\n"));
++		return -1;
++	}
++
++	return 0;
++}
++
++/* 
++   This function is used to open a raw socket to capture from
++ */
++int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
++{
++	pcap_t *pt;
++
++	pt=pcap_open_live(iface, 100, 0, 0, NULL);
++	if (pt == NULL) {
++		DEBUG(DEBUG_CRIT,("Failed to open capture device %s\n", iface));
++		return -1;
++	}
++	*((pcap_t **)private_data) = pt;
++
++	return pcap_fileno(pt);
++}
++
++/* This function is used to close the capture socket
++ */
++int ctdb_sys_close_capture_socket(void *private_data)
++{
++	pcap_t *pt = (pcap_t *)private_data;
++	pcap_close(pt);
++	return 0;
++}
++
++
++/*
++  called when the raw socket becomes readable
++ */
++int ctdb_sys_read_tcp_packet(int s, void *private_data, 
++			ctdb_sock_addr *src, ctdb_sock_addr *dst,
++			uint32_t *ack_seq, uint32_t *seq)
++{
++	int ret;
++#define RCVPKTSIZE 100
++	char pkt[RCVPKTSIZE];
++	struct ether_header *eth;
++	struct iphdr *ip;
++	struct ip6_hdr *ip6;
++	struct tcphdr *tcp;
++
++	ret = recv(s, pkt, RCVPKTSIZE, MSG_TRUNC);
++	if (ret < sizeof(*eth)+sizeof(*ip)) {
++		return -1;
++	}
++
++	/* Ethernet */
++	eth = (struct ether_header *)pkt;
++
++	/* we want either IPv4 or IPv6 */
++	if (ntohs(eth->ether_type) == ETHERTYPE_IP) {
++		/* IP */
++		ip = (struct iphdr *)(eth+1);
++
++		/* We only want IPv4 packets */
++		if (ip->version != 4) {
++			return -1;
++		}
++		/* Dont look at fragments */
++		if ((ntohs(ip->frag_off)&0x1fff) != 0) {
++			return -1;
++		}
++		/* we only want TCP */
++		if (ip->protocol != IPPROTO_TCP) {
++			return -1;
++		}
++
++		/* make sure its not a short packet */
++		if (offsetof(struct tcphdr, ack_seq) + 4 + 
++		    (ip->ihl*4) + sizeof(*eth) > ret) {
++			return -1;
++		}
++		/* TCP */
++		tcp = (struct tcphdr *)((ip->ihl*4) + (char *)ip);
++
++		/* tell the caller which one we've found */
++		src->ip.sin_family      = AF_INET;
++		src->ip.sin_addr.s_addr = ip->saddr;
++		src->ip.sin_port        = tcp->source;
++		dst->ip.sin_family      = AF_INET;
++		dst->ip.sin_addr.s_addr = ip->daddr;
++		dst->ip.sin_port        = tcp->dest;
++		*ack_seq                = tcp->ack_seq;
++		*seq                    = tcp->seq;
++
++		return 0;
++	} else if (ntohs(eth->ether_type) == ETHERTYPE_IP6) {
++		/* IP6 */
++		ip6 = (struct ip6_hdr *)(eth+1);
++
++		/* we only want TCP */
++		if (ip6->ip6_nxt != IPPROTO_TCP) {
++			return -1;
++		}
++
++		/* TCP */
++		tcp = (struct tcphdr *)(ip6+1);
++
++		/* tell the caller which one we've found */
++		src->ip6.sin6_family = AF_INET6;
++		src->ip6.sin6_port   = tcp->source;
++		src->ip6.sin6_addr   = ip6->ip6_src;
++
++		dst->ip6.sin6_family = AF_INET6;
++		dst->ip6.sin6_port   = tcp->dest;
++		dst->ip6.sin6_addr   = ip6->ip6_dst;
++
++		*ack_seq             = tcp->ack_seq;
++		*seq                 = tcp->seq;
++
++		return 0;
++	}
++
++	return -1;
++}
++
++
--- ctdb-1.0.99.orig/debian/patches/10_no-lib64.diff
+++ ctdb-1.0.99/debian/patches/10_no-lib64.diff
@@ -0,0 +1,21 @@
+Goal: Don't ship files in /usr/lib64 for amd64 port
+
+See http://bugs.debian.org/528976
+
+Author: Mathieu Parent <math.parent@gmail.com>
+
+Upstream status: Debian specific
+
+Index: b/configure
+===================================================================
+--- a/configure
++++ b/configure
+@@ -1845,7 +1845,7 @@
+ 
+ if test "${libdir}" = '${exec_prefix}/lib'; then
+   case `uname -m` in
+-    x86_64|ppc64|powerpc64)
++    ppc64|powerpc64)
+       libdir='${exec_prefix}/lib64'
+       ;;
+     *)
--- ctdb-1.0.99.orig/debian/patches/50-fix-bashism.diff
+++ ctdb-1.0.99/debian/patches/50-fix-bashism.diff
@@ -0,0 +1,24 @@
+Goal: Fix bashism
+
+See http://bugs.debian.org/547741
+
+Author: Mathieu Parent <math.parent@gmail.com>
+
+Upstream status: https://bugzilla.samba.org/show_bug.cgi?id=6407
+
+diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
+index bd31197..4d97b9a 100644
+--- a/config/events.d/11.natgw
++++ b/config/events.d/11.natgw
+@@ -43,7 +43,7 @@ case $cmd in
+ 	NATGWIP=`ctdb natgwlist | head -1 | sed -e "s/^[^ ]* *//"`
+ 
+ 	CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
+-	if [ "$NATGWMASTER" == "-1" ]; then
++	if [ "$NATGWMASTER" = "-1" ]; then
+ 		echo "There is not NATGW master node"
+ 		exit 1
+ 	fi
+-- 
+1.6.3.3
+
--- ctdb-1.0.99.orig/debian/patches/02_ctdb_diagnostics.diff
+++ ctdb-1.0.99/debian/patches/02_ctdb_diagnostics.diff
@@ -0,0 +1,21 @@
+Goal: adapt ctdb_diagnostics to debian
+
+/etc/sysconfig/ is replaced by /etc/default/
+
+Author: Mathieu Parent <math.parent@gmail.com>
+
+Upstream status: Debian specific
+
+Index: b/tools/ctdb_diagnostics
+===================================================================
+--- a/tools/ctdb_diagnostics
++++ b/tools/ctdb_diagnostics
+@@ -6,7 +6,7 @@
+ 
+ # list of config files that must exist and that we check are the same 
+ # on all nodes
+-CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /etc/ctdb/nodes /etc/sysconfig/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/sysconfig/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
++CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /etc/ctdb/nodes /etc/default/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/default/nfs /etc/exports /etc/vsftpd/vsftpd.conf"
+ 
+ # list of config files that may exist and should be checked that they
+ # are the same on all nodes
