Преглед на файлове

new package: sendfile 2.1a (Simple Asynchronous File Transfer (SAFT))

Ralf S. Engelschall преди 20 години
родител
ревизия
c354add13a
променени са 5 файла, в които са добавени 365 реда и са изтрити 0 реда
  1. 64 0
      sendfile/rc.sendfile
  2. 101 0
      sendfile/sendfile.cf
  3. 27 0
      sendfile/sendfile.patch
  4. 173 0
      sendfile/sendfile.spec
  5. BIN
      sendfile/sendfiledx.tar.gz

+ 64 - 0
sendfile/rc.sendfile

@@ -0,0 +1,64 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.sendfile -- Run-Commands
+##
+
+%config
+    sendfile_enable="$openpkg_rc_def"
+    sendfile_bind="127.0.0.1"
+    sendfile_port="487"
+    sendfile_flags=""
+    sendfile_log_prolog="true"
+    sendfile_log_epilog="true"
+    sendfile_log_numfiles="10"
+    sendfile_log_minsize="1M"
+    sendfile_log_complevel="9"
+
+%common
+    sendfile_pidfile="@l_prefix@/var/sendfile/run/sendfiled.pid"
+    sendfile_signal () {
+        [ -f $sendfile_pidfile ] && kill -$1 `cat $sendfile_pidfile`
+    }
+    sendfile_start () {
+        ( @l_prefix@/sbin/sendfiledx ${sendfile_bind}${sendfile_bind:+:}${sendfile_port:-sendfile} \
+          @l_prefix@/sbin/sendfiled ${sendfile_flags} \
+          </dev/null >/dev/null 2>&1 &
+          echo $! >$sendfile_pidfile
+        ) </dev/null >/dev/null 2>&1
+    }
+
+%status -u @l_susr@ -o
+    sendfile_usable="no"
+    sendfile_active="no"
+    rcService sendfile enable yes && \
+        sendfile_signal 0 && sendfile_active="yes"
+    echo "sendfile_enable=\"$sendfile_enable\""
+    echo "sendfile_usable=\"$sendfile_usable\""
+    echo "sendfile_active=\"$sendfile_active\""
+
+%start -p 100 -u @l_susr@
+    rcService sendfile enable yes || exit 0
+    rcService sendfile active yes && exit 0
+    sendfile_start
+
+%stop -p 900 -u @l_susr@
+    rcService sendfile enable yes || exit 0
+    rcService sendfile active no  && exit 0
+    sendfile_signal TERM
+    sleep 2
+    rm -f $sendfile_pidfile 2>/dev/null || true
+
+%restart -p 100 -u @l_susr@
+    rcService sendfile enable yes || exit 0
+    rcService sendfile active no  && exit 0
+    rc sendfile stop start
+
+%daily -u @l_susr@
+    rcService sendfile enable yes || exit 0
+    shtool rotate -f \
+        -n ${sendfile_log_numfiles} -s ${sendfile_log_minsize} -d \
+        -z ${sendfile_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
+        -P "${sendfile_log_prolog}" \
+        -E "${sendfile_log_epilog} && rc sendfile reload" \
+        @l_prefix@/var/sendfile/run/sendfiled.log
+

+ 101 - 0
sendfile/sendfile.cf

@@ -0,0 +1,101 @@
+##
+##  sendfile.cf -- Sendfile Configuration
+##
+
+#   accept only messages or files (for NFS-clients)
+#acceptonly = messages
+
+#   forward address to your generic SAFT-server (e.g. for NFS)
+#saftserver = saft.example.com
+
+#   set domain name of host if necessary
+#domain = myhost.example.com
+
+#   where shall new user configuration directories be created (SPOOL/HOME)
+userconfig = SPOOL
+
+#   allow automatic forwarding of files by the local user (on/off)
+forwarding = on
+
+#   allow automatic postprocessing of files by the local user (on/off)
+piping = on
+
+#   allow remote sender to delete his files afterwards (on/off)
+deleting = on
+
+#   maximum allowed files to receive per user
+#   setting this option too high will slow down your machine!
+maxfiles = 200
+
+#   minimum free disk space for your spool partition in MB 
+minfree = 5
+
+#   maximum total disk space usage for spool in MB 
+#   (WARNING! Defining this option will sendfile slow down! Better use minfree)
+#maxspool = 100
+
+#   list of file extensions for indicating which files are not compressible
+dontcompress = .zip,.zoo,.arj,.z,.gz,.bz,.bz2,.tgz,.mp3,.gif,.jpg,.tif,.tiff,.png,.avi,.mpeg,.pgp,.rpm,.rar,.deb
+
+#   default compression methode (none/gzip/bzip2)
+defaultcompress = gzip
+
+#   lanspeed defines what to your LAN belongs: if sending to hosts is
+#   faster than this value (KB/s), then files will not be compressed. If
+#   you set lanspeed = 0 then this feature will be disabled and every
+#   file which is not in the dontcompress list (see above) will be
+#   compressed.
+lanspeed = 100
+
+#   notification by message, mail, both or none when a file arrives
+notification = message
+
+#   ring the gong when a message arrives (on/off)
+bell = on
+
+#   keep files in spool at least xx days, then delete them (0=infinity)
+keep = 0
+
+#   delete aborted or corrupted spool files after xx days (0=never)
+deljunk = 10
+
+#   global logging of file transfer (in/out/both/none)
+log = in
+
+#   packet size to send/receive in one chunk
+#   if you are on a fast and reliable network, set this option to 1024 or 4096
+packet = 512
+
+#   logging of incoming messages in the user log file (on/off)
+msglog = off
+
+#   allow O-SAFT fetchfile extension (on/off)
+fetchfile = on
+
+#   internal environment variable PATH for sendfiled
+PATH = @l_prefix@/bin:/bin:/usr/bin:/sbin:/usr/sbin
+
+#   where is the pgp program? (used for O-SAFT/fetchfile)
+#pgp = @l_prefix@/bin/pgp
+
+#   enforce secure incoming file transfer with pgp (sign/encrypt/both/none)
+forcepgp = none
+
+#   allow spooling of outgoing files (on/nostart/off)
+#   (nostart means a client is not allowed to start the spool daemon)
+spooling = on
+
+#   allow parallel sending of spooled files = multiple daemons (on/off)
+parallel = on
+
+#   limit thruput of outgoing files to xx KB/s (0 = no limit)
+#   this makes only sense if parallel = off (see above)
+maxthruput = 0
+
+#   bounce files from outgoing spool back to the local user after xx days
+#   (when remote host is unreachable)
+bounce = 5
+
+#   retry delivering of files from outgoing spool after xx minutes
+retry = 10
+

+ 27 - 0
sendfile/sendfile.patch

@@ -0,0 +1,27 @@
+--- src/io.h.orig	Mon Mar  5 23:38:04 2001
++++ src/io.h	Mon Mar  5 23:38:04 2001
+@@ -15,6 +15,8 @@
+  * This file is covered by the GNU General Public License
+  */
+ 
++#include <sys/types.h>
++
+ 
+ /* read n bytes from network socket */
+ int readn(int, char *, int);
+--- src/sendfiled.c.org	Tue Feb  6 00:42:53 2001
++++ src/sendfiled.c	Sun Aug 26 21:21:18 2001
+@@ -4000,11 +4002,13 @@
+  * RETURN: nothing, but terminates program on error
+  */
+ void setreugid() {
++  if (rgid != getegid())
+   if (rgid && setegid(rgid)<0) {
+     printf("490 Internal error on setegid(%u): %s\r\n",
+ 	   (unsigned int)rgid,strerror(errno));
+     exit(1);
+   }
++  if (ruid != geteuid())
+   if (ruid && seteuid(ruid)<0) {
+     printf("490 Internal error on seteuid(%u): %s\r\n",
+ 	   (unsigned int)ruid,strerror(errno));

+ 173 - 0
sendfile/sendfile.spec

@@ -0,0 +1,173 @@
+##
+##  sendfile.spec -- OpenPKG RPM Specification
+##  Copyright (c) 2000-2005 The OpenPKG Project <http://www.openpkg.org/>
+##  Copyright (c) 2000-2005 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2000-2005 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:         sendfile
+Summary:      Simple Asynchronous File Transfer (SAFT)
+URL:          http://www.belwue.de/projekte/saft/sendfile.html
+Vendor:       Ulli Horlacher
+Packager:     The OpenPKG Project
+Distribution: OpenPKG
+Class:        EVAL
+Group:        Network
+License:      GPL
+Version:      2.1a
+Release:      20050319
+
+#   list of sources
+Source0:      ftp://ftp.belwue.de/pub/unix/sendfile/sendfile-%{version}.tar.gz
+Source1:      sendfiledx.tar.gz
+Source2:      sendfile.cf
+Source3:      rc.sendfile
+Patch0:       sendfile.patch
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20040130, gcc
+PreReq:       OpenPKG, openpkg >= 20040130
+BuildPreReq:  readline
+PreReq:       readline
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    Sendfile is a Unix implementation of Simple Asynchronous File
+    Transfer (SAFT) which can be used to asynchronously send/receive
+    files over the Internet.
+
+%track
+    prog sendfile = {
+        version   = %{version}
+        url       = ftp://ftp.belwue.de/pub/unix/sendfile/
+        regex     = sendfile-(__VER__)\.tar\.gz
+    }
+
+%prep
+    %setup -q
+    %setup -q -T -D -a 1
+    %patch -p0
+
+%build
+    #   configure program
+    ./makeconfig \
+        CC="%{l_cc}" \
+        CFLAGS="\"%{l_cflags -O}\"" \
+        CPPFLAGS="%{l_cppflags}" \
+        LDFLAGS="%{l_ldflags}" \
+        FIFODIR=%{l_prefix}/var/sendfile/run \
+        SPOOL=%{l_prefix}/var/sendfile/spool \
+        BINDIR=%{l_prefix}/bin \
+        MANDIR=%{l_prefix}/man \
+        CONFIG=%{l_prefix}/etc/sendfile \
+        SERVERDIR=%{l_prefix}/sbin \
+        TAR=%{l_tar} \
+        GZIP=%{l_gzip} \
+        BZIP2=%{l_bzip2} \
+        PGP=%{l_prefix}/bin/pgp \
+        RECODE=%{l_prefix}/bin/recode \
+        METAMAIL=%{l_prefix}/bin/metamail \
+        SENDMAIL=%{l_prefix}/sbin/sendmail
+
+    #   build program
+    %{l_make} %{l_mflags}
+
+    #   build sendfiledx addon
+    ( cd sendfiledx
+      CC="%{l_cc}" \
+      CFLAGS="%{l_cflags -O}" \
+      ./configure
+      %{l_make} %{l_mflags}
+    ) || exit $?
+
+%install
+    #   create installation hierarchy
+    rm -rf $RPM_BUILD_ROOT
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/bin \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
+        $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
+        $RPM_BUILD_ROOT%{l_prefix}/man/man7 \
+        $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/sendfile \
+        $RPM_BUILD_ROOT%{l_prefix}/var/sendfile/spool \
+        $RPM_BUILD_ROOT%{l_prefix}/var/sendfile/spool/OUTGOING \
+        $RPM_BUILD_ROOT%{l_prefix}/var/sendfile/spool/LOG \
+        $RPM_BUILD_ROOT%{l_prefix}/var/sendfile/run \
+        $RPM_BUILD_ROOT%{l_prefix}/var/sendfile/log
+
+    #   install programs
+    ( cd src
+      %{l_shtool} install -c -s -m 755 \
+          fetchfile receive sendfile sendmsg utf7encode wlock \
+          $RPM_BUILD_ROOT%{l_prefix}/bin/
+      %{l_shtool} install -c -s -m 755 \
+          sendfiled $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    ) || exit $?
+    ( cd etc
+      %{l_shtool} install -c -m 755 \
+          check_sendfile sf_cleanup sfconf sfdconf \
+          $RPM_BUILD_ROOT%{l_prefix}/bin/
+    ) || exit $?
+    %{l_shtool} install -c -s -m 755 \
+        sendfiledx/sendfiledx $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    ln $RPM_BUILD_ROOT%{l_prefix}/bin/utf7encode \
+       $RPM_BUILD_ROOT%{l_prefix}/bin/utf7decode
+    ln $RPM_BUILD_ROOT%{l_prefix}/bin/receive \
+       $RPM_BUILD_ROOT%{l_prefix}/bin/rf
+    ln $RPM_BUILD_ROOT%{l_prefix}/bin/sendfile \
+       $RPM_BUILD_ROOT%{l_prefix}/bin/sf
+    ln $RPM_BUILD_ROOT%{l_prefix}/bin/sendmsg \
+       $RPM_BUILD_ROOT%{l_prefix}/bin/sm
+
+    #   install manual pages
+    %{l_shtool} install -c -m 755 \
+        doc/*.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
+    %{l_shtool} install -c -m 755 \
+        doc/*.7 $RPM_BUILD_ROOT%{l_prefix}/man/man7/
+    %{l_shtool} install -c -m 755 \
+        doc/*.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
+
+    #   install default configuration
+    %{l_shtool} install -c -m 644 %{l_value -s -a} \
+        %{SOURCE sendfile.cf} $RPM_BUILD_ROOT%{l_prefix}/etc/sendfile/
+    %{l_shtool} install -c -m 644 \
+        etc/sendfile.deny $RPM_BUILD_ROOT%{l_prefix}/etc/sendfile/
+
+    #   install run-command script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.sendfile} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%config %{l_prefix}/etc/sendfile/*'
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+

BIN
sendfile/sendfiledx.tar.gz