Date: Thu, 25 Oct 2018 12:13:30 +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: r482968 - in head/net/wireguard: . files Message-ID: <201810251213.w9PCDUE1075370@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: decke Date: Thu Oct 25 12:13:30 2018 New Revision: 482968 URL: https://svnweb.freebsd.org/changeset/ports/482968 Log: net/wireguard: Update rc.d script to let the user define which wg interfaces to manage Most people will likely want to put wireguard_interfaces="wg0" in /etc/rc.conf Reported by: Jason A. Donenfeld <Jason@zx2c4.com> Modified: head/net/wireguard/Makefile head/net/wireguard/files/wireguard.in Modified: head/net/wireguard/Makefile ============================================================================== --- head/net/wireguard/Makefile Thu Oct 25 11:54:50 2018 (r482967) +++ head/net/wireguard/Makefile Thu Oct 25 12:13:30 2018 (r482968) @@ -2,6 +2,7 @@ PORTNAME= wireguard PORTVERSION= 0.0.20181018 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= https://git.zx2c4.com/WireGuard/snapshot/ DISTNAME= WireGuard-${PORTVERSION} Modified: head/net/wireguard/files/wireguard.in ============================================================================== --- head/net/wireguard/files/wireguard.in Thu Oct 25 11:54:50 2018 (r482967) +++ head/net/wireguard/files/wireguard.in Thu Oct 25 12:13:30 2018 (r482968) @@ -5,6 +5,13 @@ # PROVIDE: wireguard # REQUIRE: DAEMON # KEYWORD: shutdown +# +# wireguard_enable (bool): Set to "YES" to enable wireguard. +# (default: "NO") +# +# wireguard_interfaces (str): List of interfaces to bring up/down +# on start/stop. (eg: "wg0 wg1") +# (default: "") . /etc/rc.subr @@ -16,20 +23,20 @@ stop_cmd="${name}_stop" wireguard_start() { - for f in %%PREFIX%%/etc/wireguard/*.conf; do - %%PREFIX%%/bin/wg-quick up ${f} + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg-quick up ${interface} 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 + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg-quick down ${interface} done } load_rc_config $name + +: ${wireguard_interfaces=""} + run_rc_command "$1"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810251213.w9PCDUE1075370>