From f23266f4417724636a7e762074de2273ad8637a3 Mon Sep 17 00:00:00 2001 From: "Ralf S. Engelschall" Date: Fri, 14 Jun 2002 12:48:52 +0000 Subject: [PATCH] new package: spegla 1.1p4 (FTP Mirroring Tool) --- spegla/rc.spegla | 12 +++++ spegla/spegla-mirror | 35 +++++++++++++ spegla/spegla.conf | 34 +++++++++++++ spegla/spegla.patch | 29 +++++++++++ spegla/spegla.spec | 117 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 227 insertions(+) create mode 100644 spegla/rc.spegla create mode 100644 spegla/spegla-mirror create mode 100644 spegla/spegla.conf create mode 100644 spegla/spegla.patch create mode 100644 spegla/spegla.spec diff --git a/spegla/rc.spegla b/spegla/rc.spegla new file mode 100644 index 0000000000..4ad62f1572 --- /dev/null +++ b/spegla/rc.spegla @@ -0,0 +1,12 @@ +#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc +## +## rc.spegla -- Run-Commands for Spegla +## + +%config + spegla_enable="no" + +%hourly -u root + opServiceEnabled spegla || exit 0 + @l_prefix@/bin/spegla-mirror + diff --git a/spegla/spegla-mirror b/spegla/spegla-mirror new file mode 100644 index 0000000000..ee2c1c2dbe --- /dev/null +++ b/spegla/spegla-mirror @@ -0,0 +1,35 @@ +#!/bin/sh +## +## spegla-mirror -- Spegla Mirror Manager +## Copyright (c) 2000-2002 Ralf S. Engelschall +## + +BINDIR="@l_prefix@/bin" +ETCDIR="@l_prefix@/etc/spegla" +VARDIR="@l_prefix@/var/spegla" +PKGDIR="@l_prefix@/var/spegla/pkg" + +mirror () { + ( pkg=$1 + echo "spegla-mirror: spawning mirror for <$pkg>" >>$VARDIR/spegla-mirror.log + $BINDIR/spegla \ + --section=common --configfile=$ETCDIR/spegla.conf \ + --section=$pkg --configfile=$ETCDIR/spegla.conf \ + --lockfile=$PKGDIR/$pkg.lck \ + --logfile=$PKGDIR/$pkg.log \ + >>$VARDIR/spegla-mirror.log 2>&1 + echo "spegla-mirror: terminated mirror for <$pkg>" >>$VARDIR/spegla-mirror.log + ) >/dev/null 2>&1 & +} + +if [ $# -gt 0 ]; then + for pkg in $*; do + mirror $pkg + done +else + for pkg in `egrep '^\[[a-zA-Z].*\]' $ETCDIR/spegla.conf |\ + grep -v common | sed -e 's/\[\(.*\)\]/\1/'`; do + mirror $pkg + done +fi + diff --git a/spegla/spegla.conf b/spegla/spegla.conf new file mode 100644 index 0000000000..123e01a426 --- /dev/null +++ b/spegla/spegla.conf @@ -0,0 +1,34 @@ +## +## spegla.conf -- Spegla Mirror Configuration +## + +[common] +version = 1.1 +mirroruser = root +username = anonymous +password = spegla@ +showconf = no +warnoverrides = no +minfree = 1048576 +skip = /\.[0-9][0-9]* +treatasdirdest = \./\.[0-9][0-9]* +maxdelete = 100 +retries = 2 +retrytime = 120 +timeout = 120 +passive = yes +dodelete = yes +loglevel = 0 +skip = /\.mirror$ +skip = /\.mirror\.log$ +skip = /core$ +skip = /\.cache +skip = /\.in\..*\.$ +skip = /lost\+found/ + +#[openpkg] +#host = ftp.openpkg.org +#remotedir = / +#localdir = @l_prefix@/pub/openpkg +#skip = ^/contrib + diff --git a/spegla/spegla.patch b/spegla/spegla.patch new file mode 100644 index 0000000000..32ddf07004 --- /dev/null +++ b/spegla/spegla.patch @@ -0,0 +1,29 @@ +--- e_err.c.orig Sun May 14 23:39:39 2000 ++++ e_err.c Thu Feb 1 15:38:37 2001 +@@ -115,6 +115,7 @@ + } + + res = vsnprintf(p, len, fmt, args); ++ if (res >= len) res = len - 1; + len -= res; + p += res; + +--- spegla.c.orig Sat May 27 22:38:14 2000 ++++ spegla.c Thu Feb 1 15:39:24 2001 +@@ -728,7 +728,7 @@ + #ifdef ULTRIX + if ((f.fd_req.bfreen * 1024) < minfree) + #else +- if ((f.f_bsize * f.f_bavail) < minfree) ++ if (((long long)f.f_bsize * f.f_bavail) < minfree) + #endif + e_errx(1, "%s: Not enough space left", path); + +@@ -953,6 +953,7 @@ + } + buf[i] = p[j]; + } ++ buf[i] = '\0'; + *val = buf; + ret: + if (show) diff --git a/spegla/spegla.spec b/spegla/spegla.spec new file mode 100644 index 0000000000..703dfdb408 --- /dev/null +++ b/spegla/spegla.spec @@ -0,0 +1,117 @@ +## +## spegla.spec -- OpenPKG RPM Specification +## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH +## Copyright (c) 2000-2002 The OpenPKG Project +## Copyright (c) 2000-2002 Ralf S. Engelschall +## +## 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 options +%ifndef with_ipv6 +%define with_ipv6 no +%endif + +# package information +Name: spegla +Summary: FTP Mirroring Tool +URL: ftp://subzero.campus.luth.se/pub/spegla/ +Vendor: Jens A Nilsson +Packager: The OpenPKG Project +Distribution: OpenPKG [EXP] +Group: Network +License: BSD +Version: 1.1p4 +Release: 20020614 + +# list of sources +Source0: ftp://subzero.campus.luth.se/pub/spegla/spegla-%{version}.tar.gz +Source1: spegla.conf +Source2: spegla-mirror +Source3: rc.spegla +Patch0: spegla.patch +Patch1: http://www.imasy.or.jp/~ume/ipv6/spegla-1.1p4-ipv6-20020129.diff.gz + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20020206 +PreReq: OpenPKG, openpkg >= 20020206 +AutoReq: no +AutoReqProv: no + +%description + Spegla is fast mirroring tool for the File Transfer Protocol (FTP). + +%prep + %setup -q + %patch0 -p0 + %patch1 -p0 + cp regex/*.[ch] . + +%build + cp Makefile.linux Makefile + %{l_shtool} subst \ + -e 's;gcc;$(CC);' \ + -e 's;^\(OBJS[ ]*=\);\1 regcomp.o regerror.o regexec.o regfree.o;' \ + Makefile + CC="%{l_cc}" + CFLAGS="%{l_cflags -O} -c" +%if "%{with_ipv6}" == "yes" + DEFS="-DINET6" +%else + DEFS="" +%endif + LDFLAGS="" + case "%{l_target}" in + *-freebsd* ) DEFS="$DEFS -DFREEBSD"; LDFLAGS="$LDFLAGS -lcompat" ;; + *-linux* ) DEFS="$DEFS -DLINUX" ;; + *-solaris* ) DEFS="$DEFS -DSolaris -DMTYPES-DPROGNAME=\\\"spegla\\\"" ;; + esac + %{l_make} %{l_mflags -O} \ + CC="$CC" CFLAGS="$CFLAGS" DEFS="$DEFS" LDFLAGS="$LDFLAGS" + +%install + rm -rf $RPM_BUILD_ROOT + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/bin \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/etc/spegla \ + $RPM_BUILD_ROOT%{l_prefix}/man/man1 \ + $RPM_BUILD_ROOT%{l_prefix}/var/spegla/pkg + %{l_shtool} install -c -s -m 755 \ + spegla $RPM_BUILD_ROOT%{l_prefix}/bin/ + %{l_shtool} install -c -m 755 \ + -e 's;@l_prefix@;%{l_prefix};g' \ + %{SOURCE spegla-mirror} $RPM_BUILD_ROOT%{l_prefix}/bin/ + %{l_shtool} install -c -m 644 \ + -e 's;@l_prefix@;%{l_prefix};g' \ + %{SOURCE spegla.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/spegla/ + %{l_shtool} install -c -m 644 \ + spegla.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ + %{l_shtool} install -c -m 644 \ + -e 's;@l_prefix@;%{l_prefix};g' \ + %{SOURCE rc.spegla} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT +