From nobody Fri Nov 5 12:17:48 2021 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EDB6B1837788; Fri, 5 Nov 2021 12:17:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hlzzc6MQyz4gQT; Fri, 5 Nov 2021 12:17:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB64A17896; Fri, 5 Nov 2021 12:17:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A5CHm6j018838; Fri, 5 Nov 2021 12:17:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A5CHmNq018837; Fri, 5 Nov 2021 12:17:48 GMT (envelope-from git) Date: Fri, 5 Nov 2021 12:17:48 GMT Message-Id: <202111051217.1A5CHmNq018837@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Bernhard Froehlich Subject: git: af6b7cd3fe75 - main - net/wireguard-tools: Add status command to rc.d script List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: decke X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af6b7cd3fe758510a4ef45775315e6a733404f47 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by decke: URL: https://cgit.FreeBSD.org/ports/commit/?id=af6b7cd3fe758510a4ef45775315e6a733404f47 commit af6b7cd3fe758510a4ef45775315e6a733404f47 Author: Patrick M. Hausen AuthorDate: 2021-11-05 12:13:40 +0000 Commit: Bernhard Froehlich CommitDate: 2021-11-05 12:17:08 +0000 net/wireguard-tools: Add status command to rc.d script PR: 259397 Submitted by: Patrick M. Hausen --- net/wireguard-tools/Makefile | 1 + net/wireguard-tools/files/wireguard_lite.in | 14 +++++++++++++- net/wireguard-tools/files/wireguard_wgquick.in | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/net/wireguard-tools/Makefile b/net/wireguard-tools/Makefile index 446c723eb667..52e11f141a25 100644 --- a/net/wireguard-tools/Makefile +++ b/net/wireguard-tools/Makefile @@ -1,5 +1,6 @@ PORTNAME= wireguard-tools PORTVERSION= 1.0.20210914 +PORTREVISION= 1 CATEGORIES= net net-vpn MASTER_SITES= https://git.zx2c4.com/wireguard-tools/snapshot/ diff --git a/net/wireguard-tools/files/wireguard_lite.in b/net/wireguard-tools/files/wireguard_lite.in index 791a83c3ce55..9d33d1966fa0 100644 --- a/net/wireguard-tools/files/wireguard_lite.in +++ b/net/wireguard-tools/files/wireguard_lite.in @@ -20,11 +20,12 @@ name=wireguard rcvar=wireguard_enable -extra_commands="reload" +extra_commands="reload status" start_cmd="${name}_start" stop_cmd="${name}_stop" reload_cmd="${name}_reload" +status_cmd="${name}_status" wireguard_start() { @@ -97,6 +98,17 @@ wireguard_reload() done } +wireguard_status() +{ + wireguard_status="0" + + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg show ${interface} || wireguard_status="1" + done + + return ${wireguard_status} +} + load_rc_config $name : ${wireguard_enable="NO"} diff --git a/net/wireguard-tools/files/wireguard_wgquick.in b/net/wireguard-tools/files/wireguard_wgquick.in index 34da254ceed6..c6680e08c5ed 100644 --- a/net/wireguard-tools/files/wireguard_wgquick.in +++ b/net/wireguard-tools/files/wireguard_wgquick.in @@ -17,11 +17,12 @@ name=wireguard rcvar=wireguard_enable -extra_commands="reload" +extra_commands="reload status" start_cmd="${name}_start" stop_cmd="${name}_stop" reload_cmd="${name}_reload" +status_cmd="${name}_status" wireguard_start() { @@ -58,6 +59,18 @@ wireguard_reload() done } +wireguard_status() +{ + ${wireguard_env:+eval export $wireguard_env} + wireguard_status="0" + + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg show ${interface} || wireguard_status="1" + done + + return ${wireguard_status} +} + load_rc_config $name : ${wireguard_enable="NO"}