OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Michael Schloh
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   27-Jul-2004 19:26:57
  Branch: HEAD                             Handle: 2004072718265600

  Added files:
    openpkg-src/ucarp       fsl.ucarp rc.ucarp ucarp.spec vip-down.sh
                            vip-up.sh

  Log:
    new package: ucarp 1.0 (Common Address Redundancy Protocol for Unix)

  Summary:
    Revision    Changes     Path
    1.1         +16 -0      openpkg-src/ucarp/fsl.ucarp
    1.1         +59 -0      openpkg-src/ucarp/rc.ucarp
    1.1         +176 -0     openpkg-src/ucarp/ucarp.spec
    1.1         +18 -0      openpkg-src/ucarp/vip-down.sh
    1.1         +18 -0      openpkg-src/ucarp/vip-up.sh
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/fsl.ucarp
  ============================================================================
  $ cvs diff -u -r0 -r1.1 fsl.ucarp
  --- /dev/null 2004-07-27 19:26:57 +0200
  +++ fsl.ucarp 2004-07-27 19:26:57 +0200
  @@ -0,0 +1,16 @@
  +##
  +##  fsl.ucarp -- OSSP fsl configuration
  +##
  +
  +ident (ucarp)/.+ q{
  +    prefix(
  +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
  +    )
  +    -> {
  +        debug: file(
  +            path="@l_prefix@/var/ucarp/ucarp.log",
  +            perm=0644, monitor=3600
  +        )
  +    }
  +};
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/rc.ucarp
  ============================================================================
  $ cvs diff -u -r0 -r1.1 rc.ucarp
  --- /dev/null 2004-07-27 19:26:57 +0200
  +++ rc.ucarp  2004-07-27 19:26:57 +0200
  @@ -0,0 +1,59 @@
  [EMAIL PROTECTED]@/lib/openpkg/bash @l_prefix@/etc/rc
  +##
  +##  rc.ucarp -- Run-Commands
  +##
  +
  +%config
  +    ucarp_enable="$openpkg_rc_def"
  +    ucarp_flags=""
  +    ucarp_log_prolog="true"
  +    ucarp_log_epilog="true"
  +    ucarp_log_numfiles="10"
  +    ucarp_log_minsize="1M"
  +    ucarp_log_complevel="9"
  +
  +%common
  +    ucarp_pidfile="@l_prefix@/var/ucarp/ucarp.pid"
  +    ucarp_signal () {
  +        [ -f $ucarp_pidfile ] && kill -$1 `cat $ucarp_pidfile`
  +    }
  +
  +%status -u @l_susr@ -o
  +    ucarp_usable="unknown"
  +    ucarp_active="no"
  +    rcService ucarp enable yes && \
  +        ucarp_signal 0 && ucarp_active="yes"
  +    echo "ucarp_enable=\"$ucarp_enable\""
  +    echo "ucarp_usable=\"$ucarp_usable\""
  +    echo "ucarp_active=\"$ucarp_active\""
  +
  +%start -u @l_susr@
  +    rcService ucarp enable yes || exit 0
  +    rcService ucarp active yes && exit 0
  +    @l_prefix@/sbin/ucarp ${ucarp_flags} >/dev/null 2>&1 &
  +    echo $! >$ucarp_pidfile
  +
  +%stop -u @l_susr@
  +    rcService ucarp enable yes || exit 0
  +    rcService ucarp active no && exit 0
  +    ucarp_signal TERM
  +    sleep 2
  +    rm -f $ucarp_pidfile 2>/dev/null || true
  +
  +%restart -u @l_susr@
  +    rcService ucarp enable yes || exit 0
  +    rcService ucarp active no && exit 0
  +    rc ucarp stop
  +    sleep 2
  +    rc ucarp start
  +
  +%daily -u @l_susr@
  +    rcService ucarp enable yes || exit 0
  +    #   rotate logfile
  +    shtool rotate -f \
  +        -n ${ucarp_log_numfiles} -s ${ucarp_log_minsize} -d \
  +        -z ${ucarp_log_complevel} -m 644 -o @l_musr@ -g @l_mgrp@ \
  +        -P "${ucarp_log_prolog}" \
  +        -E "${ucarp_log_epilog}; rc ucarp restart" \
  +        @l_prefix@/var/ucarp/ucarp.log
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/ucarp.spec
  ============================================================================
  $ cvs diff -u -r0 -r1.1 ucarp.spec
  --- /dev/null 2004-07-27 19:26:57 +0200
  +++ ucarp.spec        2004-07-27 19:26:57 +0200
  @@ -0,0 +1,176 @@
  +##
  +##  ucarp.spec -- OpenPKG RPM Specification
  +##  Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  +##  Copyright (c) 2000-2004 Ralf S. Engelschall <[EMAIL PROTECTED]>
  +##  Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  +##
  +##  Permission to use, copy, modify, and distribute this software for
  +##  any purpose with or without fee is hereby granted, provided that
  +##  the above copyright notice and this permission notice appear in all
  +##  copies.
  +##
  +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +##  SUCH DAMAGE.
  +##
  +
  +#   package information
  +Name:         ucarp
  +Summary:      Common Address Redundancy Protocol for Unix
  +URL:          http://www.ucarp.org/
  +Vendor:       Frank Denis
  +Packager:     The OpenPKG Project
  +Distribution: OpenPKG
  +Class:        EVAL
  +Group:        Network
  +License:      Specific
  +Version:      1.0
  +Release:      20040727
  +
  +#   package options
  +%option       with_fsl  yes
  +
  +#   list of sources
  +Source0:      http://www.pureftpd.org/ucarp/ucarp-%{version}.tar.bz2
  +Source1:      rc.ucarp
  +Source2:      fsl.ucarp
  +Source3:      vip-up.sh
  +Source4:      vip-down.sh
  +
  +#   build information
  +Prefix:       %{l_prefix}
  +BuildRoot:    %{l_buildroot}
  +BuildPreReq:  OpenPKG, openpkg >= 20040130, libpcap, libiconv, gcc
  +PreReq:       OpenPKG, openpkg >= 20040130, libpcap, libiconv
  +%if "%{with_fsl}" == "yes"
  +BuildPreReq:  fsl >= 1.3.0
  +PreReq:       fsl >= 1.3.0
  +%endif
  +AutoReq:      no
  +AutoReqProv:  no
  +
  +%description
  +    UCARP allows a couple of hosts to share common virtual IP
  +    addresses in order to provide automatic failover. It is a
  +    portable userland implementation of the secure and patent-
  +    free Common Address Redundancy Protocol (CARP, OpenBSD's
  +    alternative to the VRRP).
  +
  +    Strong points of the CARP protocol are: very low overhead,
  +    cryptographically signed messages, interoperability between
  +    different operating systems, and no need for any dedicated
  +    extra network link between redundant hosts.
  +
  +%track
  +    prog ucarp = {
  +        version   = %{version}
  +        url       = http://www.pureftpd.org/ucarp/
  +        regex     = ucarp-(__VER__)\.tar\.bz2
  +    }
  +
  +%prep
  +    %setup -q
  +    %{l_shtool} subst \
  +        -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
  +        src/ip_carp.h \
  +        src/ucarp.h \
  +        src/carp.c
  +    case "%{l_platform -t}" in
  +        *-sunos* )
  +            %{l_shtool} subst \
  +                -e 's;\(->ether_.host\)\(\[[0-9]*\]\);\1.ether_addr_octet\2;g' \
  +                src/carp.c
  +            %{l_shtool} subst \
  +                -e 's;\(->ether_.host\),;\1.ether_addr_octet,;g' \
  +                src/garp.c
  +            ;;
  +    esac
  +
  +%build
  +    #   compensate for nonportable constructs
  +    DEFFLAGS=
  +    LIBFLAGS=
  +    case "%{l_platform -t}" in
  +        *-sunos* )
  +            DEFFLAGS="-DETHER_ADDR_LEN=6"
  +            LIBFLAGS="-lresolv"
  +            ;;
  +    esac
  +
  +    #   configure program
  +    CC="%{l_cc}" \
  +    CFLAGS="%{l_cflags -O} $DEFFLAGS" \
  +    CPPFLAGS="%{l_cppflags}" \
  +    LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  +    LIBS="%{l_fsl_libs} -lpcap $LIBFLAGS" \
  +    ./configure \
  +        --disable-nls \
  +        --prefix=%{l_prefix} \
  +        --sysconfdir=%{l_prefix}/etc/ucarp \
  +        --localstatedir=%{l_prefix}/var/ucarp \
  +        --with-libiconv-prefix=%{l_prefix}
  +
  +    #   build program
  +    %{l_make} %{l_mflags -O}
  +
  +%install
  +    #   install program
  +    rm -rf $RPM_BUILD_ROOT
  +    %{l_make} %{l_mflags} install-strip AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  +
  +    #   create directory structure
  +    %{l_shtool} mkdir -f -p -m 755 \
  +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
  +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  +        $RPM_BUILD_ROOT%{l_prefix}/etc/ucarp \
  +        $RPM_BUILD_ROOT%{l_prefix}/var/ucarp
  +
  +    #   install default configuration
  +    %{l_shtool} install -c -m 644 \
  +        %{SOURCE vip-down.sh} \
  +        %{SOURCE vip-up.sh} \
  +        $RPM_BUILD_ROOT%{l_prefix}/etc/ucarp/
  +
  +    #   install runcommand script
  +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
  +        %{SOURCE rc.ucarp} \
  +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  +
  +    #   install OSSP fsl configuration
  +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
  +        %{SOURCE fsl.ucarp} \
  +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  +
  +    #   determine installation files
  +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  +        %{l_files_std} \
  +        '%config %{l_prefix}/etc/ucarp/*'
  +
  +%files -f files
  +
  +%clean
  +    rm -rf $RPM_BUILD_ROOT
  +
  +%post
  +    #   after upgrade, restart service
  +    [ $1 -eq 2 ] || exit 0
  +    eval `%{l_rc} ucarp status 2>/dev/null`
  +    [ ".$ucarp_active" = .yes ] && %{l_rc} ucarp restart
  +    exit 0
  +
  +%preun
  +    #   before erase, stop service and remove log files
  +    [ $1 -eq 0 ] || exit 0
  +    %{l_rc} ucarp stop 2>/dev/null
  +    rm -f $RPM_INSTALL_PREFIX/var/ucarp/*.log >/dev/null 2>&1 || true
  +    exit 0
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/vip-down.sh
  ============================================================================
  $ cvs diff -u -r0 -r1.1 vip-down.sh
  --- /dev/null 2004-07-27 19:26:57 +0200
  +++ vip-down.sh       2004-07-27 19:26:57 +0200
  @@ -0,0 +1,18 @@
  +#! /bin/sh
  +
  +# From UCARP online documentation
  +# ---------------------------------------------------------
  +# Of course, anything can go in this scripts. For instance,
  +# you may want to add routes, to add something to log files
  +# or to send mail. And last but not least, you can use a
  +# script that will connect to your switches and flush their
  +# ARP cache. The interface name is passed as an argument to
  +# the called scripts, so feel free to replace "eth0" with
  +# "$1" in this example.
  +
  +if [ -x /sbin/route ]; then
  +    /sbin route delete 127.0.0.2 127.0.0.1 eth0
  +elif [ -x /usr/sbin/route ]; then
  +    /usr/sbin route delete 127.0.0.2 127.0.0.1 eth0
  +fi
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/ucarp/vip-up.sh
  ============================================================================
  $ cvs diff -u -r0 -r1.1 vip-up.sh
  --- /dev/null 2004-07-27 19:26:57 +0200
  +++ vip-up.sh 2004-07-27 19:26:57 +0200
  @@ -0,0 +1,18 @@
  +#! /bin/sh
  +
  +# From UCARP online documentation
  +# ---------------------------------------------------------
  +# Of course, anything can go in this scripts. For instance,
  +# you may want to add routes, to add something to log files
  +# or to send mail. And last but not least, you can use a
  +# script that will connect to your switches and flush their
  +# ARP cache. The interface name is passed as an argument to
  +# the called scripts, so feel free to replace "eth0" with
  +# "$1" in this example.
  +
  +if [ -x /sbin/route ]; then
  +    /sbin route add 127.0.0.2 127.0.0.1 eth0
  +elif [ -x /usr/sbin/route ]; then
  +    /usr/sbin route add 127.0.0.2 127.0.0.1 eth0
  +fi
  +
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to