summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/dtcp/Makefile25
-rw-r--r--net/dtcp/files/dtcpc.sh41
-rw-r--r--net/dtcp/files/dtcps.sh63
-rw-r--r--net/dtcp/pkg-plist4
4 files changed, 126 insertions, 7 deletions
diff --git a/net/dtcp/Makefile b/net/dtcp/Makefile
index 3f2bf60b4e2c..8096b869cf80 100644
--- a/net/dtcp/Makefile
+++ b/net/dtcp/Makefile
@@ -7,7 +7,7 @@
PORTNAME= dtcp
PORTVERSION= 20030228
-#PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= net ipv6
MASTER_SITES= http://www.imasy.or.jp/~ume/ipv6/ \
http://home.jp.FreeBSD.org/~ume/ipv6/
@@ -15,6 +15,8 @@ MASTER_SITES= http://www.imasy.or.jp/~ume/ipv6/ \
MAINTAINER= ume@FreeBSD.org
COMMENT= Dynamic Tunnel Configuration Protocol daemon and client
+USE_RC_SUBR= YES
+
.if !defined(DTCP_CLIENT_ONLY)
RUN_DEPENDS= qpopauth:${PORTSDIR}/mail/qpopper
.endif
@@ -26,6 +28,9 @@ RUBY_SHEBANG_FILES= ${WRKSRC}/dtcpauth.rb ${WRKSRC}/dtcpc.rb \
MAN8= dtcpauth.8 dtcpc.8 dtcps.8
MANCOMPRESSED= yes
+RC_SCRIPTS= ${PREFIX}/etc/rc.d/dtcpc.sh ${PREFIX}/etc/rc.d/dtcps.sh
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} RUBY=${RUBY}
+
pre-everything::
.if !defined(DTCP_CLIENT_ONLY)
@${ECHO_MSG} ""
@@ -34,10 +39,20 @@ pre-everything::
@${ECHO_MSG} ""
.endif
+pre-install:
+ @for script in ${RC_SCRIPTS}; do \
+ if [ -f $${script} ]; then \
+ echo "Remove old $${script} before install."; \
+ exit 1; \
+ fi; \
+ done
+
post-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/dtcpc.sh \
- ${PREFIX}/etc/rc.d/dtcpc.sh.sample
- ${INSTALL_SCRIPT} ${WRKSRC}/dtcps.sh \
- ${PREFIX}/etc/rc.d/dtcps.sh.sample
+ @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${FILESDIR}/dtcpc.sh > ${PREFIX}/etc/rc.d/dtcpc.sh
+ @${CHMOD} ${BINMODE} ${PREFIX}/etc/rc.d/dtcpc.sh
+ @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${FILESDIR}/dtcps.sh > ${PREFIX}/etc/rc.d/dtcps.sh
+ @${CHMOD} ${BINMODE} ${PREFIX}/etc/rc.d/dtcps.sh
.include <bsd.port.mk>
diff --git a/net/dtcp/files/dtcpc.sh b/net/dtcp/files/dtcpc.sh
new file mode 100644
index 000000000000..2c814e6e1e9e
--- /dev/null
+++ b/net/dtcp/files/dtcpc.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: dtcpc
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move dtcpc.sh to /etc/rc.d/dtcpc
+
+prefix=%%PREFIX%%
+
+# Define these dtcpc_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/dtcpc
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+dtcpc_enable=${dtcpc_enable:-"NO"} # Enable dtcpc
+#dtcpc_program="${prefix}/sbin/dtcpc" # Location of dtcpc
+dtcpc_server=${dtcpc_server:-""} # DTCP server name
+dtcpc_username=${dtcpc_username:-""} # DTCP user name
+dtcpc_flags=${dtcpc_flags:-"-t network -Dl"} # Flags to dtcpc program
+
+. %%RC_SUBR%%
+
+name="dtcpc"
+rcvar=`set_rcvar`
+command="${prefix}/sbin/${name}"
+command_interpreter="%%RUBY%%"
+pidfile="/var/run/${name}.pid"
+extra_commands="reload"
+
+load_rc_config $name
+flags="${dtcpc_flags} -u ${dtcpc_username} ${dtcpc_server}"
+run_rc_command "$1"
diff --git a/net/dtcp/files/dtcps.sh b/net/dtcp/files/dtcps.sh
new file mode 100644
index 000000000000..47978983f9a5
--- /dev/null
+++ b/net/dtcp/files/dtcps.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: dtcps
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move dtcps.sh to /etc/rc.d/dtcps
+
+prefix=%%PREFIX%%
+
+# Define these dtcps_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/dtcps
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+dtcps_enable=${dtcps_enable:-"NO"} # Enable dtcps
+#dtcps_program="${prefix}/sbin/dtcps" # Location of dtcps
+dtcps_tunif=${dtcps_tunif:-""} # tunnel interface
+dtcps_prefix=${dtcps_prefix:-""} # prefix for host tunnel type
+dtcps_flags=${dtcps_flags:-""} # Flags to dtcps program
+
+# interface cloning example
+#dtcps_tunif='gif70'
+
+# static allocation example
+#dtcps_unit_min=70
+#dtcps_unit_max=79
+#dtcps_tunif='gif7[0-9]'
+
+# prefix for host tunnel type.
+# YOU MUST CHANGE TO ASSIGN THIS WITHIN YOUR ADDRESS BLOCK.
+#dtcps_prefix='3ffe:501:185b:8000::'
+
+. %%RC_SUBR%%
+
+name="dtcps"
+rcvar=`set_rcvar`
+command="${prefix}/sbin/${name}"
+command_interpreter="%%RUBY%%"
+pidfile="/var/run/${name}.pid"
+start_precmd="dtcps_prestart"
+
+dtcps_prestart() {
+ if [ -n "${dtcps_unit_min}" -a -n "${dtcps_unit_max}" ]; then
+ unit=${dtcps_unit_min}
+ while [ ${unit} -le ${dtcps_unit_max} ]; do
+ ifconfig gif${unit} create >/dev/null 2>&1
+ unit=$((${unit}+1))
+ done
+ fi
+}
+
+load_rc_config $name
+flags="-i ${dtcps_tunif} ${dtcps_flags} ${dtcps_prefix}"
+run_rc_command "$1"
diff --git a/net/dtcp/pkg-plist b/net/dtcp/pkg-plist
index 8b2b017c01cc..8593e1138cc5 100644
--- a/net/dtcp/pkg-plist
+++ b/net/dtcp/pkg-plist
@@ -1,5 +1,5 @@
sbin/dtcpauth
sbin/dtcpc
sbin/dtcps
-etc/rc.d/dtcpc.sh.sample
-etc/rc.d/dtcps.sh.sample
+etc/rc.d/dtcpc.sh
+etc/rc.d/dtcps.sh