aboutsummaryrefslogtreecommitdiffstats
path: root/net/irrd
diff options
context:
space:
mode:
Diffstat (limited to 'net/irrd')
-rw-r--r--net/irrd/Makefile11
-rw-r--r--net/irrd/files/irrd.sh28
-rw-r--r--net/irrd/files/patch-database.c13
-rw-r--r--net/irrd/files/patch-uii_commands.c55
-rw-r--r--net/irrd/pkg-plist1
5 files changed, 107 insertions, 1 deletions
diff --git a/net/irrd/Makefile b/net/irrd/Makefile
index 463c5f0af6e6..aaf1ad9bf75a 100644
--- a/net/irrd/Makefile
+++ b/net/irrd/Makefile
@@ -17,10 +17,14 @@ COMMENT= Internet Routing Registry database server
WRKSRC= ${WRKDIR}/${PORTNAME}${PORTVERSION}/src
+RUN_DEPENDS= wget:${PORTSDIR}/ftp/wget
+
MAN8= irrd.8
IRRD_CONFDIR= ${PREFIX}/etc
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
+USE_RC_SUBR= yes
USE_REINPLACE= yes
GNU_CONFIGURE= yes
CONFIGURE_ENV= YACC="${YACC}"
@@ -33,7 +37,7 @@ CONFIGURE_ARGS+= --enable-ipv6
.endif
post-patch:
- ${REINPLACE_CMD} -e 's|/etc/irrd.conf|${PREFIX}/etc/irrd.conf|g' \
+ ${REINPLACE_CMD} -e 's|/etc/irrd.conf|${IRRD_CONFDIR}/irrd.conf|g' \
${WRKSRC}/programs/IRRd/irrd.8 \
${WRKSRC}/programs/IRRd/main.c \
${WRKSRC}/programs/hdr_comm/read_conf.c \
@@ -43,11 +47,16 @@ post-patch:
${WRKSRC}/programs/irrdcacher/irrdcacher \
${WRKSRC}/programs/rps_dist/rpsdist.c
+post-build:
+ ${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${FILESDIR}/irrd.sh > ${WRKDIR}/irrd.sh
+
post-install:
@${INSTALL_SCRIPT} ${WRKSRC}/programs/irrdcacher/irrdcacher ${PREFIX}/sbin
@${INSTALL_SCRIPT} ${WRKSRC}/programs/irrdcacher/ripe2rpsl ${PREFIX}/sbin
@${INSTALL_SCRIPT} ${WRKSRC}/programs/irrdcacher/update_source ${PREFIX}/sbin
@${INSTALL_DATA} ${WRKSRC}/../samples/irrd.conf.sample ${IRRD_CONFDIR}
@${INSTALL_DATA} ${WRKSRC}/programs/IRRd/irrd.8 ${PREFIX}/man/man8
+ @${INSTALL_SCRIPT} ${WRKDIR}/irrd.sh ${PREFIX}/etc/rc.d
.include <bsd.port.mk>
diff --git a/net/irrd/files/irrd.sh b/net/irrd/files/irrd.sh
new file mode 100644
index 000000000000..77bff7f81717
--- /dev/null
+++ b/net/irrd/files/irrd.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# $FreeBSD$
+
+# PROVIDE: irrd
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: FreeBSD shutdown
+
+# Define these irrd_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/irrd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+irrd_enable="${irrd_enable:-NO}" # Enable irrd
+#irrd_program="%%PREFIX%%/sbin/irrd" # Location of irrd
+irrd_flags="${irrd_flags:--u}" # Flags to imapd program
+
+. %%RC_SUBR%%
+
+name="irrd"
+rcvar=`set_rcvar`
+command="%%PREFIX%%/sbin/irrd"
+required_files="%%PREFIX%%/etc/irrd.conf"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/net/irrd/files/patch-database.c b/net/irrd/files/patch-database.c
new file mode 100644
index 000000000000..1b8e2a1cf2ed
--- /dev/null
+++ b/net/irrd/files/patch-database.c
@@ -0,0 +1,13 @@
+--- programs/IRRd/database.c.orig Fri Oct 18 05:02:29 2002
++++ programs/IRRd/database.c Thu Apr 22 17:13:52 2004
+@@ -61,7 +61,9 @@
+ HASH_Clear (db->hash_spec);
+
+ db->radix = New_Radix (128);
+- fclose (db->db_fp);
++
++ if (db->db_fp != NULL)
++ fclose (db->db_fp);
+
+ db->db_fp = NULL;
+ db->db_syntax = EMPTY_DB;
diff --git a/net/irrd/files/patch-uii_commands.c b/net/irrd/files/patch-uii_commands.c
new file mode 100644
index 000000000000..9f1dbfe8b986
--- /dev/null
+++ b/net/irrd/files/patch-uii_commands.c
@@ -0,0 +1,55 @@
+--- programs/IRRd/uii_commands.c.orig Tue Feb 5 05:53:57 2002
++++ programs/IRRd/uii_commands.c Thu Apr 22 18:13:29 2004
+@@ -14,6 +14,8 @@
+ #include <ctype.h>
+ #include "irrd.h"
+
++#include <errno.h>
++
+ #include <fcntl.h>
+ #ifndef SETPGRP_VOID
+ #endif
+@@ -720,6 +722,10 @@
+
+ void run_cmd (char *cmd, FILE **in, FILE **out) {
+ int pin[2], pout[2];
++ int pid;
++ int omask, pstat;
++ pid_t ppid;
++ extern int errno;
+
+ if (in != NULL)
+ *in = NULL;
+@@ -733,7 +739,9 @@
+ if (out != NULL)
+ pipe (pout);
+
+- if (fork() == 0) { /* We're the child */
++/* if (fork() == 0) { */
++ pid = fork();
++ if (pid == 0) { /* We're the child */
+ if (in != NULL) {
+ close (pin[1]);
+ dup2 (pin[0], 0);
+@@ -747,7 +755,7 @@
+ close (pout[1]);
+ }
+
+- execl("/bin/sh", "sh", "-c", cmd, NULL);
++ execlp("/bin/sh", "sh", "-c", cmd, NULL);
+ _exit(127);
+ }
+
+@@ -761,6 +769,12 @@
+ close (pin[0]);
+ *in = fdopen (pin[1], "w");
+ }
++
++ omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
++ do {
++ ppid = waitpid(pid, (int *) &pstat, 0);
++ } while (pid == -1 && errno == EINTR);
++ (void)sigsetmask(omask);
+ }
+
+ int kill_irrd (uii_connection_t *uii) {
diff --git a/net/irrd/pkg-plist b/net/irrd/pkg-plist
index 4071288da40d..5d2904f7eca0 100644
--- a/net/irrd/pkg-plist
+++ b/net/irrd/pkg-plist
@@ -6,3 +6,4 @@ sbin/irrdcacher
sbin/ripe2rpsl
sbin/update_source
etc/irrd.conf.sample
+etc/rc.d/irrd.sh