git: 9986bb780c47 - main - net/wireguard-tools: Various fixes for the rc.d scripts
Bernhard Froehlich
decke at FreeBSD.org
Wed Apr 7 19:48:34 UTC 2021
The branch main has been updated by decke:
URL: https://cgit.FreeBSD.org/ports/commit/?id=9986bb780c473fe5a1a2821d14aead6b3bcaadbe
commit 9986bb780c473fe5a1a2821d14aead6b3bcaadbe
Author: Bernhard Froehlich <decke at FreeBSD.org>
AuthorDate: 2021-04-07 19:46:38 +0000
Commit: Bernhard Froehlich <decke at FreeBSD.org>
CommitDate: 2021-04-07 19:46:38 +0000
net/wireguard-tools: Various fixes for the rc.d scripts
- Introduce wireguard_confdir to rc.d script
- Fix variables and load_rc_config order in rc.d script
- Change rc.d scripts to run earlier after NETWORKING is available
Submitted by: niels at netbox.org
---
net/wireguard-tools/Makefile | 2 +-
net/wireguard-tools/files/wireguard_lite.in | 19 +++++++++++--------
net/wireguard-tools/files/wireguard_wgquick.in | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/net/wireguard-tools/Makefile b/net/wireguard-tools/Makefile
index 0f06481f8279..47131508ab73 100644
--- a/net/wireguard-tools/Makefile
+++ b/net/wireguard-tools/Makefile
@@ -1,6 +1,6 @@
PORTNAME= wireguard-tools
PORTVERSION= 1.0.20210315
-PORTREVISION= 3
+PORTREVISION= 4
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 0784c13a7497..791a83c3ce55 100644
--- a/net/wireguard-tools/files/wireguard_lite.in
+++ b/net/wireguard-tools/files/wireguard_lite.in
@@ -1,7 +1,7 @@
#!/bin/sh
# PROVIDE: wireguard
-# REQUIRE: DAEMON
+# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# wireguard_enable (bool): Set to "YES" to enable wireguard.
@@ -10,17 +10,14 @@
# wireguard_interfaces (str): List of interfaces to bring up/down
# on start/stop. (eg: "wg0 wg1")
# (default: "")
+# wireguard_confdir (str): Config directory that contains wg0.conf
+# (default: "%%PREFIX%%/etc/wireguard")
# wireguard_<iface>_ips (str): List of IP Addresses for iface
# wireguard_<iface>_routes (str): List of Routes for this iface
# wireguard_<iface>_mtu (str): MTU for iface (default: "1500")
. /etc/rc.subr
-load_rc_config $name
-
-: ${wireguard_enable="NO"}
-: ${wireguard_interfaces=""}
-
name=wireguard
rcvar=wireguard_enable
extra_commands="reload"
@@ -39,7 +36,7 @@ wireguard_start()
eval wireguard_mtu="\${wireguard_${interface}_mtu}"
ifconfig ${interface} create
- %%PREFIX%%/bin/wg setconf ${interface} %%PREFIX%%/etc/wireguard/${interface}.conf
+ %%PREFIX%%/bin/wg setconf ${interface} ${wireguard_confdir}/${interface}.conf
for ip in ${wireguard_ips}; do
if [ "${ip#*:}" != "${ip}" ]; then
@@ -96,8 +93,14 @@ wireguard_stop()
wireguard_reload()
{
for interface in ${wireguard_interfaces}; do
- %%PREFIX%%/bin/wg syncconf ${interface} %%PREFIX%%/etc/wireguard/${interface}.conf
+ %%PREFIX%%/bin/wg syncconf ${interface} ${wireguard_confdir}/${interface}.conf
done
}
+load_rc_config $name
+
+: ${wireguard_enable="NO"}
+: ${wireguard_interfaces=""}
+: ${wireguard_confdir="%%PREFIX%%/etc/wireguard"}
+
run_rc_command "$1"
diff --git a/net/wireguard-tools/files/wireguard_wgquick.in b/net/wireguard-tools/files/wireguard_wgquick.in
index df39926c232e..34da254ceed6 100644
--- a/net/wireguard-tools/files/wireguard_wgquick.in
+++ b/net/wireguard-tools/files/wireguard_wgquick.in
@@ -1,7 +1,7 @@
#!/bin/sh
# PROVIDE: wireguard
-# REQUIRE: DAEMON
+# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# wireguard_enable (bool): Set to "YES" to enable wireguard.
More information about the dev-commits-ports-all
mailing list