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:
parent
027ba60997
commit
af6b7cd3fe
@ -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/
|
||||
|
||||
|
@ -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"}
|
||||
|
@ -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"}
|
||||
|
Loading…
Reference in New Issue
Block a user