Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
diff files/fwireguard.in @ 471:e2555d5fc61f
Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to.
By default this variable is set to "AUTO" to determine the interfaces automatically.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 22 Aug 2024 14:07:27 +0200 |
| parents | f8858fc8c7f3 |
| children | 692c6357ce39 |
line wrap: on
line diff
--- a/files/fwireguard.in Thu Aug 22 03:34:36 2024 +0200 +++ b/files/fwireguard.in Thu Aug 22 14:07:27 2024 +0200 @@ -33,6 +33,11 @@ : ${fwireguard_enable:="NO"} : ${fwireguard_wait="2s"} : ${fwireguard_configdir:="%%PREFIX%%/etc/fwireguard"} +: ${fwireguard_interfaces="AUTO"} + + +# Automatically expand to the interface names if needed +[ "${fwireguard_interfaces}" = "AUTO" ] && fwireguard_interfaces="$(/sbin/ifconfig -g wg)" fwireguard_start() @@ -42,7 +47,7 @@ if [ ! -d "${fwireguard_configdir}" ]; then mkdir "${fwireguard_configdir}" fi - for _if in `/sbin/ifconfig -g wg`; do + for _if in ${fwireguard_interfaces}; do _f="${fwireguard_configdir}/${_if}.key" if [ ! -f "${_f}" ]; then @@ -91,7 +96,7 @@ { local _if - for _if in `/sbin/ifconfig -g wg`; do + for _if in ${fwireguard_interfaces}; do if [ -x "${fwireguard_configdir}/${_if}.pre-stop" ]; then "${fwireguard_configdir}/${_if}.pre-stop" fi @@ -110,7 +115,7 @@ { local _if - for _if in `/sbin/ifconfig -g wg`; do + for _if in ${fwireguard_interfaces}; do /usr/bin/wg show "${_if}" done }
