aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeech <beech@FreeBSD.org>2008-03-11 09:41:13 +0800
committerbeech <beech@FreeBSD.org>2008-03-11 09:41:13 +0800
commitee3041877da2258442be0c2972059a113441488e (patch)
tree74f50a8c665406ad09d8567f11b83b298283700b
parent8c5440a03918bb8305efd6c73644e88b4421bb7e (diff)
downloadfreebsd-ports-gnome-ee3041877da2258442be0c2972059a113441488e.tar.gz
freebsd-ports-gnome-ee3041877da2258442be0c2972059a113441488e.tar.zst
freebsd-ports-gnome-ee3041877da2258442be0c2972059a113441488e.zip
- Fix rc.d script
- Install sendfile.cf.sample by default - Additional Makefile tweaks [1] PR: ports/120342 Submitted by: Stefan Sec Zehl <sec@42.org> (maintainer) Approved by: maintainer timeout (two weeks) [1]
-rw-r--r--net/sendfile/Makefile19
-rw-r--r--net/sendfile/files/patch-ab45
-rw-r--r--net/sendfile/files/sendfiled.in32
-rw-r--r--net/sendfile/pkg-plist18
4 files changed, 98 insertions, 16 deletions
diff --git a/net/sendfile/Makefile b/net/sendfile/Makefile
index 134447973ba9..f878dda865b3 100644
--- a/net/sendfile/Makefile
+++ b/net/sendfile/Makefile
@@ -7,17 +7,20 @@
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
+MASTER_SITES= ftp://ftp.belwue.de/pub/unix/sendfile/current/
+DISTNAME= ${PORTNAME}-20010216
MAINTAINER= sec@42.org
COMMENT= Simple Asynchronous File Transfer Reference Implementation
HAS_CONFIGURE= yes
-CONFIGURE_SCRIPT=makeconfig
+CONFIGURE_SCRIPT= makeconfig
CONFIGURE_ENV= PREFIX="${PREFIX}"
+USE_RC_SUBR= sendfiled
+MAKE_ARGS+= BATCH=true
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
MAN1= sendfile.1 sendmsg.1 receive.1 fetchfile.1 utf7encode.1 \
wlock.1
@@ -25,4 +28,12 @@ MAN7= fetchfile.7
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
+
.include <bsd.port.mk>
diff --git a/net/sendfile/files/patch-ab b/net/sendfile/files/patch-ab
index fddb80308b59..5ab752664dd6 100644
--- a/net/sendfile/files/patch-ab
+++ b/net/sendfile/files/patch-ab
@@ -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 --git a/net/sendfile/files/sendfiled.in b/net/sendfile/files/sendfiled.in
new file mode 100644
index 000000000000..36a8bffce22e
--- /dev/null
+++ b/net/sendfile/files/sendfiled.in
@@ -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
+#
+
+. %%RC_SUBR%%
+
+name="sendfiled"
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/sbin/sendfiled"
+command_args="-Q"
+required_files="%%PREFIX%%/etc/sendfile.cf"
+
+# read configuration and set defaults
+load_rc_config "$name"
+: ${sendfiled_enable="NO"}
+: ${sendfiled_flags=""}
+
+run_rc_command "$1"
diff --git a/net/sendfile/pkg-plist b/net/sendfile/pkg-plist
index 58c8a6b1b3f0..84152094ad3b 100644
--- a/net/sendfile/pkg-plist
+++ b/net/sendfile/pkg-plist
@@ -13,9 +13,6 @@ bin/sm
bin/utf7decode
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 +20,16 @@ sbin/sendfiled
@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