Date: Thu, 11 Oct 2018 12:49:45 +0000 (UTC) From: Bernhard Froehlich <decke@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r481820 - in head/net/wireguard: . files Message-ID: <201810111249.w9BCnjJj064924@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: decke Date: Thu Oct 11 12:49:45 2018 New Revision: 481820 URL: https://svnweb.freebsd.org/changeset/ports/481820 Log: net/wireguard: Add rc.d script Submitted by: Steve Hay <hay.steve@gmail.com> Added: head/net/wireguard/files/ head/net/wireguard/files/wireguard.in (contents, props changed) Modified: head/net/wireguard/Makefile Modified: head/net/wireguard/Makefile ============================================================================== --- head/net/wireguard/Makefile Thu Oct 11 12:28:32 2018 (r481819) +++ head/net/wireguard/Makefile Thu Oct 11 12:49:45 2018 (r481820) @@ -2,6 +2,7 @@ PORTNAME= wireguard PORTVERSION= 0.0.20181007 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= https://git.zx2c4.com/WireGuard/snapshot/ DISTNAME= WireGuard-${PORTVERSION} @@ -16,6 +17,7 @@ RUN_DEPENDS= bash:shells/bash \ wireguard-go:net/wireguard-go USES= gmake tar:xz +USE_RC_SUBR= ${PORTNAME} WRKSRC= ${WRKDIR}/${DISTNAME}/src/tools Added: head/net/wireguard/files/wireguard.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/wireguard/files/wireguard.in Thu Oct 11 12:49:45 2018 (r481820) @@ -0,0 +1,38 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: wireguard +# REQUIRE: DAEMON +# KEYWORD: shutdown + +. /etc/rc.subr + +name=wireguard +rcvar=wireguard_enable + +start_cmd="${name}_start" +stop_cmd="${name}_stop" + +wireguard_start() +{ + for f in %%PREFIX%%/etc/wireguard/*.conf; do + %%PREFIX%%/bin/wg-quick up ${f} + done +} + +wireguard_stop() +{ + %%PREFIX%%/bin/wg show interfaces | while IFS= read -r interfaces; + do + for interface in $interfaces; do + %%PREFIX%%/wg-quick down ${interface} + done + done + + # race condition in wg-quick down + sleep 1 +} + +load_rc_config $name +run_rc_command "$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810111249.w9BCnjJj064924>