1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

net/wireguard-tools: Add status command to rc.d script

PR:		259397
Submitted by:	Patrick M. Hausen <pmh@hausen.com>
This commit is contained in:
Patrick M. Hausen 2021-11-05 12:13:40 +00:00 committed by Bernhard Froehlich
parent 027ba60997
commit af6b7cd3fe
No known key found for this signature in database
GPG Key ID: 4DD88C3F9F3B8333
3 changed files with 28 additions and 2 deletions

View File

@ -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/

View File

@ -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"}

View File

@ -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"}