# Created by: Yuri Victorovich <yuri@rawbw.com>
# $FreeBSD: tags/RELEASE_10_3_0/security/vm-to-tor/Makefile 400416 2015-10-28 20:30:13Z pawel $

PORTNAME=	vm-to-tor
PORTVERSION=	0.150519
CATEGORIES=	security net

MAINTAINER=	yuri@rawbw.com
COMMENT=	Connect virtual machines to the tor network

LICENSE=	BSD4CLAUSE

RUN_DEPENDS=	tor:${PORTSDIR}/security/tor \
		tiny-dhcp-server:${PORTSDIR}/net/tiny-network-utilities

USE_GITHUB=	yes
GH_ACCOUNT=	yurivict
GH_TAGNAME=	17bdb91

NO_BUILD=	yes
NO_ARCH=	yes
SUB_FILES=	pkg-message

PLIST_FILES+=	etc/rc.d/${PORTNAME} bin/vm-ctrl
PLIST_FILES+=	"@sample etc/${PORTNAME}.rc.conf.simple.sample"
PLIST_FILES+=	"@sample etc/${PORTNAME}.rc.conf.complex.sample"

.include <bsd.port.pre.mk>

.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1000000
BROKEN=		Does not work on FreeBSD versions earlier than 10
.endif

post-patch:
	@${REINPLACE_CMD} 's|"/usr/local"|"${LOCALBASE}"|' \
		${WRKSRC}/${PORTNAME}
	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' \
		-e 's|etc/rc\.conf\.|etc/${PORTNAME}.rc.conf.|' \
		${WRKSRC}/rc.conf.*.sample

do-install:
	${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/etc/rc.d
	${INSTALL_SCRIPT} ${WRKSRC}/vm-ctrl ${STAGEDIR}${PREFIX}/bin
	${INSTALL_SCRIPT} ${WRKSRC}/rc.conf.simple.sample \
		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.rc.conf.simple.sample
	${INSTALL_SCRIPT} ${WRKSRC}/rc.conf.complex.sample \
		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.rc.conf.complex.sample

.include <bsd.port.post.mk>
