aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunechika SUMIKAWA <sumikawa@FreeBSD.org>2010-01-26 06:53:20 +0000
committerMunechika SUMIKAWA <sumikawa@FreeBSD.org>2010-01-26 06:53:20 +0000
commitd9a35a7f8164759207a4ae90ee773bc7072a39e8 (patch)
tree86d24a8e9f96bf4b8fd51a5e59fc6665a6b3ea8a
parent9e1b35cd5dff5871f6842b4688f76df5a8f8e66b (diff)
downloadports-d9a35a7f8164759207a4ae90ee773bc7072a39e8.tar.gz
ports-d9a35a7f8164759207a4ae90ee773bc7072a39e8.zip
use $SUB_FILES to dynamically update zebractl
PR: ports/143155 Submitted by: Sevan Janiyan
Notes
Notes: svn path=/head/; revision=248596
-rw-r--r--net/zebra/Makefile12
-rw-r--r--net/zebra/files/zebractl.in57
-rw-r--r--net/zebra/files/zebractl.sh57
3 files changed, 62 insertions, 64 deletions
diff --git a/net/zebra/Makefile b/net/zebra/Makefile
index b2ffd1f185c5..6a37825fb238 100644
--- a/net/zebra/Makefile
+++ b/net/zebra/Makefile
@@ -7,7 +7,7 @@
PORTNAME= zebra
PORTVERSION= 0.95a
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net ipv6
MASTER_SITES= ftp://ftp.zebra.org/pub/zebra/ \
ftp://ftp.ripe.net/mirrors/sites/ftp.zebra.org/pub/zebra/ \
@@ -20,8 +20,7 @@ COMMENT= Free RIPv1, RIPv2, OSPFv2, BGP4 route software (server/reflector)
CONFLICTS= openbgpd-[0-9]* quagga-[0-9]*
-PKGMESSAGE= ${WRKDIR}/pkg-message
-SUB_FILES= pkg-message
+SUB_FILES= pkg-message zebractl
USE_SUBMAKE= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/zebra
@@ -43,6 +42,8 @@ MAN1= vtysh.1
MAN8= bgpd.8 ospf6d.8 ospfd.8 ripd.8 ripngd.8 zebra.8
INFO= zebra
+.include <bsd.port.options.mk>
+
.if defined (WITHOUT_IPV6)
CONFIGURE_ARGS+=--disable-ipv6
WITHOUT_OSPF6D= yes
@@ -112,10 +113,7 @@ PLIST_SUB+= VTYSH="@comment "
post-install:
@( cd ${WRKSRC}/doc; ${RM} -f zebra*info*; ${MAKE} zebra.info install )
@${ECHO} "===> installing zebra startup file..."
- @${SED} -e "s=!!PREFIX!!=${PREFIX}=" \
- < ${FILESDIR}/zebractl.sh \
- > ${PREFIX}/sbin/zebractl
- @${CHMOD} 555 ${PREFIX}/sbin/zebractl
+ ${INSTALL_SCRIPT} ${WRKDIR}/zebractl ${PREFIX}/sbin/zebractl
@${ECHO} "done."
@${CAT} ${PKGMESSAGE}
diff --git a/net/zebra/files/zebractl.in b/net/zebra/files/zebractl.in
new file mode 100644
index 000000000000..46ba05882c60
--- /dev/null
+++ b/net/zebra/files/zebractl.in
@@ -0,0 +1,57 @@
+#! /bin/sh
+#
+# $FreeBSD: /tmp/pcvs/ports/net/zebra/files/zebractl.in,v 1.1 2010-01-26 06:53:20 sumikawa Exp $
+#
+# zebra start/stop script by "Andreas Klemm <andreas@FreeBSD.ORG>"
+#
+
+usage()
+{
+ echo "$0: usage: $0 [ start | stop | restart ]"
+ exit 1
+}
+
+if [ $# -lt 1 ]; then
+ echo "$0: error: one argument needed"; usage
+elif [ $# -gt 1 ]; then
+ echo "$0: error: only one argument needed"; usage
+fi
+
+case $1 in
+ start)
+ if [ ! -f %%ETCDIR%%/zebra.conf ]; then
+ echo "error: zebra.conf config file is mandatory"
+ exit 1
+ fi
+ [ -f %%ETCDIR%%/zebra.conf ] \
+ && %%PREFIX%%/sbin/zebra -d && echo -n ' zebra'
+ [ -f %%ETCDIR%%/ripd.conf ] \
+ && %%PREFIX%%/sbin/ripd -d && echo -n ' ripd'
+ [ -f %%ETCDIR%%/ripngd.conf ] \
+ && %%PREFIX%%/sbin/ripngd -d && echo -n ' ripngd'
+ [ -f %%ETCDIR%%/ospfd.conf ] \
+ && %%PREFIX%%/sbin/ospfd -d && echo -n ' ospfd'
+ [ -f %%ETCDIR%%/ospf6d.conf ] \
+ && %%PREFIX%%/sbin/ospf6d -d && echo -n ' ospf6d'
+ [ -f %%ETCDIR%%/bgpd.conf ] \
+ && %%PREFIX%%/sbin/bgpd -d && echo -n ' bgpd'
+ ;;
+
+ stop)
+ [ -f %%ETCDIR%%/ripd.conf ] && killall ripd
+ [ -f %%ETCDIR%%/ripngd.conf ] && killall ripngd
+ [ -f %%ETCDIR%%/ospfd.conf ] && killall ospfd
+ [ -f %%ETCDIR%%/ospf6d.conf ] && killall ospf6d
+ [ -f %%ETCDIR%%/bgpd.conf ] && killall bgpd
+ [ -f %%ETCDIR%%/zebra.conf ] && killall zebra
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+
+ *) echo "$0: error: unknown option $1"
+ usage
+ ;;
+esac
+exit 0
diff --git a/net/zebra/files/zebractl.sh b/net/zebra/files/zebractl.sh
deleted file mode 100644
index f2ea589111b0..000000000000
--- a/net/zebra/files/zebractl.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#! /bin/sh
-#
-# $FreeBSD: /tmp/pcvs/ports/net/zebra/files/Attic/zebractl.sh,v 1.8 2002-08-04 20:04:50 sumikawa Exp $
-#
-# zebra start/stop script by "Andreas Klemm <andreas@FreeBSD.ORG>"
-#
-
-usage()
-{
- echo "$0: usage: $0 [ start | stop | restart ]"
- exit 1
-}
-
-if [ $# -lt 1 ]; then
- echo "$0: error: one argument needed"; usage
-elif [ $# -gt 1 ]; then
- echo "$0: error: only one argument needed"; usage
-fi
-
-case $1 in
- start)
- if [ ! -f !!PREFIX!!/etc/zebra/zebra.conf ]; then
- echo "error: zebra.conf config file is mandatory"
- exit 1
- fi
- [ -f !!PREFIX!!/etc/zebra/zebra.conf ] \
- && !!PREFIX!!/sbin/zebra -d && echo -n ' zebra'
- [ -f !!PREFIX!!/etc/zebra/ripd.conf ] \
- && !!PREFIX!!/sbin/ripd -d && echo -n ' ripd'
- [ -f !!PREFIX!!/etc/zebra/ripngd.conf ] \
- && !!PREFIX!!/sbin/ripngd -d && echo -n ' ripngd'
- [ -f !!PREFIX!!/etc/zebra/ospfd.conf ] \
- && !!PREFIX!!/sbin/ospfd -d && echo -n ' ospfd'
- [ -f !!PREFIX!!/etc/zebra/ospf6d.conf ] \
- && !!PREFIX!!/sbin/ospf6d -d && echo -n ' ospf6d'
- [ -f !!PREFIX!!/etc/zebra/bgpd.conf ] \
- && !!PREFIX!!/sbin/bgpd -d && echo -n ' bgpd'
- ;;
-
- stop)
- [ -f !!PREFIX!!/etc/zebra/ripd.conf ] && killall ripd
- [ -f !!PREFIX!!/etc/zebra/ripngd.conf ] && killall ripngd
- [ -f !!PREFIX!!/etc/zebra/ospfd.conf ] && killall ospfd
- [ -f !!PREFIX!!/etc/zebra/ospf6d.conf ] && killall ospf6d
- [ -f !!PREFIX!!/etc/zebra/bgpd.conf ] && killall bgpd
- [ -f !!PREFIX!!/etc/zebra/zebra.conf ] && killall zebra
- ;;
- restart)
- $0 stop
- $0 start
- ;;
-
- *) echo "$0: error: unknown option $1"
- usage
- ;;
-esac
-exit 0