Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  7 Feb 2008 12:24:04 +0100 (CET)
From:      Stefan `Sec` Zehl <sec@42.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/120342: improvement of net/sendfile port
Message-ID:  <20080207112404.79AF0B848@ice.42.org>
Resent-Message-ID: <200802071130.m17BU1dX059905@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         120342
>Category:       ports
>Synopsis:       improvement of net/sendfile port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 07 11:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Stefan `Sec` Zehl
>Release:        FreeBSD 6.3-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD ice 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #41: Sat Jan 19 03:15:08 CET 2008 root@ice:/export/obj/export/src/sys/ICE i386


	
>Description:

This update fixes the rc.d script of the net/sendfile port, and also
improves the sendfile.cf handling by installing sendfile.cf.sample by default.

	
>How-To-Repeat:
	
>Fix:

	

diff -burN sendfile/Makefile sendfile.new/Makefile
--- sendfile/Makefile	2003-02-21 13:15:01.000000000 +0000
+++ sendfile.new/Makefile	2008-02-07 11:21:03.000000000 +0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	sendfile
 PORTVERSION=	2.1a
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=   ftp://ftp.belwue.de/pub/unix/sendfile/current/
 DISTFILES=	sendfile-20010216.tar.gz
@@ -25,4 +25,13 @@
 MAN8=		sendfiled.8
 MLINKS=		utf7encode.1 utf7decode.1
 
+post-install:
+	@if [ ! -f ${PREFIX}/etc/sendfile.cf ]; then \
+	  ${CP} -p ${PREFIX}/etc/sendfile.cf.sample ${PREFIX}/etc/sendfile.cf ; \
+	fi
+	@if [ ! -f ${PREFIX}/etc/sendfile.deny ]; then \
+	  ${CP} -p ${PREFIX}/etc/sendfile.deny.sample ${PREFIX}/etc/sendfile.deny ; \
+	fi
+	${INSTALL_SCRIPT} ${FILESDIR}/sendfiled.sh ${PREFIX}/etc/rc.d/
+
 .include <bsd.port.mk>
diff -burN sendfile/files/patch-ab sendfile.new/files/patch-ab
--- sendfile/files/patch-ab	2001-03-06 17:24:23.000000000 +0000
+++ sendfile.new/files/patch-ab	2008-02-07 11:02:30.000000000 +0000
@@ -1,5 +1,5 @@
---- develop/install.orig	Mon Mar  5 23:27:57 2001
-+++ develop/install	Mon Mar  5 23:34:38 2001
+--- develop/install.orig	1999-12-07 09:40:11.000000000 +0000
++++ develop/install	2008-02-07 11:02:26.000000000 +0000
 @@ -82,7 +82,6 @@
    make_man fetchfile 7 $manmisc
    make_man sendfiled 8 $manadmin
@@ -23,6 +23,29 @@
  
  umask 022
  
+@@ -233,16 +224,16 @@
+     mv $NOSENDFILE $DENY
+   fi
+ fi
+-if [ ! -f $DENY -a ! -f $ALLOW ]; then 
++if [ ! -f ${DENY}.sample -a ! -f $ALLOW ]; then 
+   echo "installing the sendfile deny file as $DENY"
+-  cp etc/sendfile.deny $DENY
+-  chmod 644 $DENY
++  cp etc/sendfile.deny ${DENY}.sample
++  chmod 644 ${DENY}.sample
+ fi
+ 
+-if [ ! -f $CONFIG ]; then 
++if [ ! -f ${CONFIG}.sample ]; then 
+   echo "installing the global sendfile config file as $CONFIG"
+-  cp etc/sendfile.cf $CONFIG
+-  chmod 644 $CONFIG
++  cp etc/sendfile.cf ${CONFIG}.sample
++  chmod 644 ${CONFIG}.sample
+ else 
+   if [ "`diff etc/sendfile.cf $CONFIG`" ]; then
+     echo "Warning: `pwd`/etc/sendfile.cf differs from $CONFIG !"
 @@ -250,6 +241,23 @@
    fi
  fi
@@ -73,7 +96,16 @@
  if [ ! -d "$SPOOL/OUTGOING" ]; then
    echo "creating $SPOOL"
    mkdir_recursive $SPOOL/OUTGOING
-@@ -344,15 +351,12 @@
+@@ -334,7 +341,7 @@
+ fi
+ 
+ free=`$SERVERDIR/sendfiled -f`
+-minfree=`awk '/minfree =/{print $3}' $CONFIG`
++minfree=`awk '/minfree =/{print $3}' ${CONFIG}.sample`
+ if [ "$free" -le "$minfree" ]; then
+   cat <<EOD
+ 		! WARNING ! 
+@@ -344,15 +351,15 @@
  EOD
  fi
  
@@ -83,13 +115,16 @@
 -echo "This will start an outgoing spooling sendfile daemon on boot time"
 -echo "which processes any old files in the outgoing spool."
 -echo
-+echo "[ -x $SERVERDIR/sendfiled ] && $SERVERDIR/sendfiled -Q && echo -n ' sendfiled'">${PREFIX}/etc/rc.d/sendfiled.sh
-+chmod a+x ${PREFIX}/etc/rc.d/sendfiled.sh
++echo "### Please add 'sendfiled_enable=YES' to your /etc/rc.conf"
  
  if [ "$RESTART" = true ]; then
 -  echo
 -  echo "please restart now your inetd ( or simply reboot :-) )"
++  if [ ! -f /var/run/inetd.pid ] ; then
++    echo "# Cant restart inetd. Perhaps it isn't running?"
++  else
 +  kill -HUP `cat /var/run/inetd.pid`
++  fi
    echo
  fi
 +[ -f $SERVERDIR/sendfiled.old ] && rm -f $SERVERDIR/sendfiled.old
diff -burN sendfile/files/sendfiled.sh sendfile.new/files/sendfiled.sh
--- sendfile/files/sendfiled.sh	1970-01-01 00:00:00.000000000 +0000
+++ sendfile.new/files/sendfiled.sh	2008-02-07 10:32:25.000000000 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: sendfiled
+# REQUIRE: LOGIN
+# BEFORE:  securelevel
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `sendfiled':
+#
+#sendfiled_enable="YES"
+#
+# See sendfiled(8) for sendfiled_flags
+#
+
+. "/etc/rc.subr"
+
+name="sendfiled"
+rcvar=`set_rcvar`
+
+command="/usr/local/sbin/sendfiled"
+command_args="-Q"
+required_files="/usr/local/etc/sendfile.cf"
+
+# read configuration and set defaults
+load_rc_config "$name"
+: ${sendfiled_enable="NO"}
+: ${sendfiled_flags=""}
+
+run_rc_command "$1"
diff -burN sendfile/pkg-plist sendfile.new/pkg-plist
--- sendfile/pkg-plist	2000-03-09 20:00:41.000000000 +0000
+++ sendfile.new/pkg-plist	2008-02-07 11:09:30.000000000 +0000
@@ -14,8 +14,6 @@
 bin/utf7encode
 bin/wlock
 etc/rc.d/sendfiled.sh
-etc/sendfile.cf
-etc/sendfile.deny
 sbin/sendfiled
 @exec mkdir -p /var/spool/sendfile/OUTGOING /var/spool/sendfile/LOG
 @exec chmod 755 /var/spool/sendfile
@@ -23,9 +21,16 @@
 @exec chmod 700 /var/spool/sendfile/LOG
 @exec touch /var/spool/sendfile/LOG/in /var/spool/sendfile/LOG/out
 @exec chmod 600 /var/spool/sendfile/LOG/in /var/spool/sendfile/LOG/out
-@exec echo -e 'saft\tstream\ttcp\tnowait\troot\t/usr/local/sbin/sendfiled sendfiled' >> /etc/inetd.conf
+@exec echo -e 'saft\tstream\ttcp\tnowait\troot\t%D/sbin/sendfiled sendfiled' >> /etc/inetd.conf
 @exec echo -e 'saft\t\t487/tcp\t# simple asynchronous file transfer'>>/etc/services
-@exec kill -HUP `ps auxw|awk '$11 == "inetd" { print $2 } '`
+@exec kill -HUP `ps auxw|awk '$11 == "inetd" { print $2 } '` >/dev/null 2>&1 ||true
 @unexec perl -pi.bak -e '/^saft/ && ($_="")' /etc/inetd.conf
-@unexec kill -HUP `ps auxw|awk '$11 == "inetd" { print $2 } '`
-@unexec rm -R /var/spool/sendfile
+@unexec kill -HUP `ps auxw|awk '$11 == "inetd" { print $2 } '` >/dev/null 2>&1||true
+@unexec rm -R /var/spool/sendfile 2>&1 >/dev/null || true
+
+@unexec if cmp -s %D/etc/sendfile.cf.sample %D/etc/sendfile.cf; then rm -f %D/etc/sendfile.cf; fi
+@exec if [ ! -f %D/etc/sendfile.cf ] ; then cp -p %D/etc/sendfile.cf.sample %D/etc/sendfile.cf; fi
+@unexec if cmp -s %D/etc/sendfile.deny.sample %D/etc/sendfile.deny; then rm -f %D/etc/sendfile.deny; fi
+@exec if [ ! -f %D/etc/sendfile.deny ] ; then cp -p %D/etc/sendfile.deny.sample %D/etc/sendfile.deny; fi
+etc/sendfile.cf.sample
+etc/sendfile.deny.sample


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080207112404.79AF0B848>