[prev in list] [next in list] [prev in thread] [next in thread] 

List:       samba-technical
Subject:    [PATCH]ctdb : enable building debian packages
From:       Johan De Wit <jdewit () x-tend ! be>
Date:       2007-10-30 15:24:18
Message-ID: 20525015.6991193757858485.JavaMail.root () zimbra ! x-tend ! be
[Download RAW message or body]

Hi,

patches are against revision-id: tridge@samba.org-20071029231943-0p5319r0hc3c7d4a

Attached two patches.

ctdb_events.patch

* added 11.route eventscript, and adjusted ctdb.sysconfig, as an example how to
  configure the default route on public addresses
* Adjusted 50.samba, to make it work on debian

ctdb_debian_package.patch

* Added ctdb/packages/debian/etch/* files to build debian packages

  HOWTO:
  
  cd ctdb source
  cp -a packages/debian/etch debian
  chmod 755 debian/rules
  dpkg-buildpackage -rfakeroot

Thx 

-- 
Johan De Wit

Linux & Open Source Consultant 

X-Tend , your partner for Linux & Open Source Solutions
Business Park King Square
Veldkant 35D
B-2550 KONTICH
------------------------------------------------------------------
www.X-Tend.be

["ctdb_events.patch" (text/x-patch)]

diff -uNr ctdb-20071029.674.org/config/ctdb.sysconfig ctdb-20071029.674/config/ctdb.sysconfig
--- ctdb-20071029.674.org/config/ctdb.sysconfig	2007-10-30 15:44:48.000000000 +0100
+++ ctdb-20071029.674/config/ctdb.sysconfig	2007-10-30 15:20:57.000000000 +0100
@@ -29,6 +29,13 @@
 # impact performance.
 # CTDB_SINGLE_PUBLIC_IP=10.1.1.1
 
+# Should ctdb configure a default route when it configures a public interface,
+# or an IP takeover occurs ?
+# This will add a default route for the public addresses.
+
+#CTDB_PUBLIC_NETWORK="default"
+#CTDB_PUBLIC_GATEWAY="10.1.1.1"
+
 # should ctdb manage starting/stopping the Samba service for you?
 # default is to not manage Samba
 # CTDB_MANAGES_SAMBA=yes
diff -uNr ctdb-20071029.674.org/config/events.d/11.route ctdb-20071029.674/config/events.d/11.route
--- ctdb-20071029.674.org/config/events.d/11.route	1970-01-01 01:00:00.000000000 +0100
+++ ctdb-20071029.674/config/events.d/11.route	2007-10-30 15:21:40.000000000 +0100
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+. /etc/ctdb/functions
+loadconfig ctdb
+
+cmd="$1"
+shift
+
+case $cmd in
+    takeip)
+         # we ignore errors from this, as the route might be up already when we're grabbing
+         # a 2nd IP on this interface
+         if [ -n $CTDB_PUBLIC_NETWORK ] && [ -n $CTDB_PUBLIC_GATEWAY ]
+         then
+           /sbin/ip route add $CTDB_PUBLIC_NETWORK via $CTDB_PUBLIC_GATEWAY dev $1 2> /dev/null
+         fi
+         ;;
+esac
+
+exit 0
diff -uNr ctdb-20071029.674.org/config/events.d/50.samba ctdb-20071029.674/config/events.d/50.samba
--- ctdb-20071029.674.org/config/events.d/50.samba	2007-10-30 15:44:48.000000000 +0100
+++ ctdb-20071029.674/config/events.d/50.samba	2007-10-30 15:18:44.000000000 +0100
@@ -11,6 +11,20 @@
 
 [ "$CTDB_MANAGES_SAMBA" = "yes" ] || exit 0
 
+# check howto start the samba service
+if [ -f /etc/init.d/smb ]
+then
+  smbservice=smb
+elif [ -f /etc/init.d/samba ]
+then
+  smbservice=samba
+else
+  echo "No startup script found for the samba service"
+  exit 1
+fi
+
+
+
 # set default samba cleanup period - in minutes
 [ -z "$SAMBA_CLEANUP_PERIOD" ] && {
     SAMBA_CLEANUP_PERIOD=10
@@ -31,7 +45,7 @@
 	/bin/mkdir -p $CTDB_BASE/state/samba
 
 	# make sure samba is not already started
-	service smb stop > /dev/null 2>&1
+	service $smbservice stop > /dev/null 2>&1
 	service winbind stop > /dev/null 2>&1
 	killall -0 -q smbd winbindd && {
 	    sleep 1
@@ -43,7 +57,7 @@
 	# the number of smbd processes will mean that it leaves few cycles for
 	# anything else
 	service winbind start
-	nice service smb start
+	nice service $smbservice start
 	;;
 	
      takeip)
@@ -61,7 +75,7 @@
 
      shutdown)
 	# shutdown Samba when ctdb goes down
-	service smb stop
+	service $smbservice stop
 	service winbind stop
 	;;
 

["ctdb_debian_package.patch" (text/x-patch)]

diff -uNr ctdb-20071029.674.org/packaging/debian/etch/changelog \
                ctdb-20071029.674/packaging/debian/etch/changelog
--- ctdb-20071029.674.org/packaging/debian/etch/changelog	1970-01-01 \
                01:00:00.000000000 +0100
+++ ctdb-20071029.674/packaging/debian/etch/changelog	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1,37 @@
+ctdb (1.0-5) unstable; urgency=low
+
+  * moved to svn version 20071029 revno 674 
+  * events.d/50.samba debianized
+
+ -- Johan De Wit <johan@build.cluster.tst>  Thu, 25 Oct 2007 10:07:11 +0200
+
+ctdb (1.0-4) unstable; urgency=low
+
+  * 11.route is now installed 
+  * reversed /etc/init.d/ctdb and /etc/default/ctdb to source version
+
+ -- Johan De Wit <johan@build.cluster.tst>  Thu, 25 Oct 2007 10:07:11 +0200
+
+ctdb (1.0-3) unstable; urgency=low
+
+  * init script, surpressing command output 
+  * Added route event script, and related vars in default/ctdb
+
+ -- Johan De Wit <johan@build.cluster.tst>  Tue, 23 Oct 2007 13:31:45 +0200
+
+ctdb (1.0-2) unstable; urgency=low
+
+  * Added dependency.  Iproute is needed to make the ip take-over working 
+  * Minor cleanup ctdb init file
+
+ -- Johan De Wit <johan@x-tend.be>  Tue, 23 Oct 2007 10:55:04 +0200
+
+ctdb (1.0-1) unstable; urgency=low
+
+  * Initial release 
+  * Basic attemp to debianize the RH5El rpm
+  * - Moved /etc/sysconfig/ctdb to /etc/default/ctdb.  File not in src tree
+  * - Adopted /etc/init.d/ctdb to be more compliant to the debian policy
+
+ -- Johan De Wit <johan@x-tend.be>  Mon, 22 Oct 2007 13:41:42 +0200
+
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/compat \
                ctdb-20071029.674/packaging/debian/etch/compat
--- ctdb-20071029.674.org/packaging/debian/etch/compat	1970-01-01 01:00:00.000000000 \
                +0100
+++ ctdb-20071029.674/packaging/debian/etch/compat	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1 @@
+5
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/conffiles \
                ctdb-20071029.674/packaging/debian/etch/conffiles
--- ctdb-20071029.674.org/packaging/debian/etch/conffiles	1970-01-01 \
                01:00:00.000000000 +0100
+++ ctdb-20071029.674/packaging/debian/etch/conffiles	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1,2 @@
+/etc/init.d/ctdb
+/etc/default/ctdb
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/control \
                ctdb-20071029.674/packaging/debian/etch/control
--- ctdb-20071029.674.org/packaging/debian/etch/control	1970-01-01 01:00:00.000000000 \
                +0100
+++ ctdb-20071029.674/packaging/debian/etch/control	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1,13 @@
+Source: ctdb
+Section: unknown
+Priority: extra
+Maintainer: Johan De Wit <johan@x-tend.be>
+Build-Depends: debhelper (>= 5), autotools-dev
+Standards-Version: 3.7.2
+
+Package: ctdb
+Architecture: i386
+Depends: ${shlibs:Depends}, ${misc:Depends}, iptables, iproute, ethtool, psmisc, \
net-tools, coreutils, sysvconfig +Description: Clustered Temporary Database
+  Clustered temporary database used by the samba project.
+  See http://ctdb.samba.org
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/copyright \
                ctdb-20071029.674/packaging/debian/etch/copyright
--- ctdb-20071029.674.org/packaging/debian/etch/copyright	1970-01-01 \
                01:00:00.000000000 +0100
+++ ctdb-20071029.674/packaging/debian/etch/copyright	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1,34 @@
+This package was debianized by Johan De Wit <johan@x-tend.be> on
+Mon, 22 Oct 2007 13:41:42 +0200.
+
+It was downloaded from <http://ctdb.samba.org>
+
+Upstream Author: Andrew Tridgell
+
+Copyright: Copyright (C) Andrew Tridgell  2007
+
+License:
+
+   This package 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, or
+   (at your option) any later version.
+
+   This package 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 package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2007, Johan De Wit <johan@x-tend.be> and
+is licensed under the GPL, see above.
+
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/dirs \
                ctdb-20071029.674/packaging/debian/etch/dirs
--- ctdb-20071029.674.org/packaging/debian/etch/dirs	1970-01-01 01:00:00.000000000 \
                +0100
+++ ctdb-20071029.674/packaging/debian/etch/dirs	2007-10-30 15:48:36.000000000 +0100
@@ -0,0 +1,4 @@
+usr/bin
+usr/sbin
+/etc/ctdb
+/etc/init.d
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/postinst \
                ctdb-20071029.674/packaging/debian/etch/postinst
--- ctdb-20071029.674.org/packaging/debian/etch/postinst	1970-01-01 \
                01:00:00.000000000 +0100
+++ ctdb-20071029.674/packaging/debian/etch/postinst	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1,29 @@
+#!/bin/sh
+
+case "$1" in
+    configure)
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# Automatically added by dh_installinit
+if [ -x "/etc/init.d/ctdb" ]; then
+	update-rc.d ctdb start 80 2 3 4 5 . stop 02 0 1 6 S . >/dev/null
+
+#	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+#		invoke-rc.d ctdb start || exit $?
+#	else
+#		/etc/init.d/ctdb start || exit $?
+#	fi
+fi
+# End automatically added section
+echo "Configure the ctdb daemon before starting up ! (see /etc/default/ctdb)"
+
+exit 0
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/postrm \
                ctdb-20071029.674/packaging/debian/etch/postrm
--- ctdb-20071029.674.org/packaging/debian/etch/postrm	1970-01-01 01:00:00.000000000 \
                +0100
+++ ctdb-20071029.674/packaging/debian/etch/postrm	2007-10-30 15:48:36.000000000 \
+0100 @@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+# Automatically added by dh_installinit
+if [ "$1" = "purge" ] ; then
+	update-rc.d ctdb remove >/dev/null || exit $?
+fi
+# End automatically added section
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/prerm \
                ctdb-20071029.674/packaging/debian/etch/prerm
--- ctdb-20071029.674.org/packaging/debian/etch/prerm	1970-01-01 01:00:00.000000000 \
                +0100
+++ ctdb-20071029.674/packaging/debian/etch/prerm	2007-10-30 15:48:36.000000000 +0100
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+# Automatically added by dh_installinit
+if [ -x "/etc/init.d/ctdb" ]; then
+	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+		invoke-rc.d ctdb stop || exit $?
+	else
+		/etc/init.d/ctdb stop || exit $?
+	fi
+fi
+# End automatically added section
diff -uNr ctdb-20071029.674.org/packaging/debian/etch/rules \
                ctdb-20071029.674/packaging/debian/etch/rules
--- ctdb-20071029.674.org/packaging/debian/etch/rules	1970-01-01 01:00:00.000000000 \
                +0100
+++ ctdb-20071029.674/packaging/debian/etch/rules	2007-10-30 15:49:32.000000000 +0100
@@ -0,0 +1,122 @@
+#!/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
+
+
+# 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
+
+configure:
+	./autogen.sh
+
+config.status: configure
+	dh_testdir
+	# Add here commands to configure the package.
+	# always run autogen.sh
+	./autogen.sh
+	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/ \
+		--bindir=\$${prefix}usr/bin \
+		--sbindir=\$${prefix}usr/sbin \
+		--datarootdir=\$${prefix}usr/share \
+		--includedir=\$${prefix}usr/include \
+		--mandir=\$${prefix}usr/share/man \
+		--localstatedir=\$${prefix}var \
+		--sysconfdir=\$${prefix}etc \
+		CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+
+build: build-stamp
+
+build-stamp:  config.status
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp 
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) distclean
+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
+
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/ctdb.
+
+	$(MAKE) prefix=$(CURDIR)/debian/ctdb/ install
+	mkdir -p $(CURDIR)/debian/ctdb/etc/init.d
+	mkdir -p $(CURDIR)/debian/ctdb/etc/default
+	/usr/bin/install -c -m 755  config/ctdb.init $(CURDIR)/debian/ctdb/etc/init.d/ctdb
+	/usr/bin/install -c -m 644  config/ctdb.sysconfig \
$(CURDIR)/debian/ctdb/etc/default/ctdb +
+# 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 
+	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 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic