Date: Fri, 5 Nov 2021 12:17:48 GMT From: Bernhard Froehlich <decke@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: af6b7cd3fe75 - main - net/wireguard-tools: Add status command to rc.d script Message-ID: <202111051217.1A5CHmNq018837@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by decke: URL: https://cgit.FreeBSD.org/ports/commit/?id=af6b7cd3fe758510a4ef45775315e6a733404f47 commit af6b7cd3fe758510a4ef45775315e6a733404f47 Author: Patrick M. Hausen <pmh@hausen.com> AuthorDate: 2021-11-05 12:13:40 +0000 Commit: Bernhard Froehlich <decke@FreeBSD.org> 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 <pmh@hausen.com> --- 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"}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111051217.1A5CHmNq018837>