Package: ucarp
Version: 1.2-1
Followup-For: Bug #264007

The attached patch allows configuration of ucarp via
/etc/network/interfaces; I think it's probably the sanest way of
configuring ucarp and allowing multiple interfaces while still fitting
in with the Debian way of doing things.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.6
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages ucarp depends on:
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries
ii  libpcap0.7                    0.7.2-7    System interface for user-level pa

Versions of packages ucarp recommends:
ii  iproute                       20051007-4 Professional tools to control the 

-- no debconf information
diff -ruN ucarp-1.2/debian/if-up ucarp-1.2-new/debian/if-up
--- ucarp-1.2/debian/if-up      1970-01-01 01:00:00.000000000 +0100
+++ ucarp-1.2-new/debian/if-up  2006-07-21 21:53:19.000000000 +0100
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+UCARP=/usr/sbin/ucarp
+
+if [ ! -x $UCARP ]; then
+       exit 0
+fi
+
+if [ -z "$IF_UCARP_UPSCRIPT" ]; then
+       IF_UCARP_UPSCRIPT=/usr/share/ucarp/vip-up
+fi
+
+if [ -z "$IF_UCARP_DOWNSCRIPT" ]; then
+       IF_UCARP_DOWNSCRIPT=/usr/share/ucarp/vip-down
+fi
+
+if [ -n "$IF_UCARP_VID" -a -n "$IF_UCARP_VIP" -a \
+               -n "$IF_UCARP_PASSWORD" ]; then
+       $UCARP -i $IFACE -s $IF_ADDRESS -B \
+               -v $IF_UCARP_VID -p $IF_UCARP_PASSWORD -a $IF_UCARP_VIP \
+               -u $IF_UCARP_UPSCRIPT -d $IF_UCARP_DOWNSCRIPT
+fi
diff -ruN ucarp-1.2/debian/README.Debian ucarp-1.2-new/debian/README.Debian
--- ucarp-1.2/debian/README.Debian      2006-07-21 22:01:43.000000000 +0100
+++ ucarp-1.2-new/debian/README.Debian  2006-07-21 22:01:06.000000000 +0100
@@ -1,7 +1,27 @@
 ucarp for Debian
 ----------------
 
-Check out the sample scripts in /usr/share/docs/examples for ideas on
-upscript/downscript usage. 
+ucarp can be configured via /etc/network/interfaces. For example:
+
+iface eth0 inet static
+       address 10.0.0.2
+       netmask 255.255.255.0
+       ucarp-vid 3
+       ucarp-vip 10.0.0.1
+       ucarp-password 16charsatmost
+iface eth0:ucarp inet static
+       address 10.0.0.1
+       netmask 255.255.255.255
+
+will cause ucarp to be started when eth0 is brought up, using a vid of 3
+and a password of 16charsatmost with the virtual IP of 10.0.0.1. When ucarp
+determines that this host is the master eth0:ucarp will be brought up -
+you can use the normal pre-up/up stanzas in /etc/network/interfaces if you
+have extra things to do when the virtual IP comes up.
+
+You can also override the default up/down scripts
+(/usr/share/ucarp/vip-{down,up}) by using the ucarp-upscript and
+ucarp-downscript options. Note that you must ensure your scripts take
+care of bringing the VIP up and down if you do this.
 
  -- Eric Evans <[EMAIL PROTECTED]>, Fri, 30 Apr 2004 01:50:44 +0000
diff -ruN ucarp-1.2/debian/rules ucarp-1.2-new/debian/rules
--- ucarp-1.2/debian/rules      2006-07-21 22:01:43.000000000 +0100
+++ ucarp-1.2-new/debian/rules  2006-07-21 21:53:32.000000000 +0100
@@ -57,6 +57,14 @@
        dh_installdirs
 
        $(MAKE) install DESTDIR=$(CURDIR)/debian/ucarp
+       install -d $(CURDIR)/debian/ucarp/etc/network/if-up.d
+       install -d $(CURDIR)/debian/ucarp/usr/share/ucarp
+       install -m 755 $(CURDIR)/debian/if-up \
+                       $(CURDIR)/debian/ucarp/etc/network/if-up.d/ucarp
+       install -m 755 $(CURDIR)/debian/vip-up \
+                       $(CURDIR)/debian/ucarp/usr/share/ucarp/vip-up
+       install -m 755 $(CURDIR)/debian/vip-down \
+                       $(CURDIR)/debian/ucarp/usr/share/ucarp/vip-down
 
 
 # Build architecture-independent files here.
diff -ruN ucarp-1.2/debian/vip-down ucarp-1.2-new/debian/vip-down
--- ucarp-1.2/debian/vip-down   1970-01-01 01:00:00.000000000 +0100
+++ ucarp-1.2-new/debian/vip-down       2006-07-21 21:38:40.000000000 +0100
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/sbin/ifdown $1:ucarp
diff -ruN ucarp-1.2/debian/vip-up ucarp-1.2-new/debian/vip-up
--- ucarp-1.2/debian/vip-up     1970-01-01 01:00:00.000000000 +0100
+++ ucarp-1.2-new/debian/vip-up 2006-07-21 21:38:43.000000000 +0100
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/sbin/ifup $1:ucarp

Reply via email to