git: a9f7f114e5cc - main - sysutils/vagrant: Respect hier(7) for networks.conf

From: Michael Gmelin <grembo_at_FreeBSD.org>
Date: Wed, 05 Oct 2022 16:28:04 UTC
The branch main has been updated by grembo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a9f7f114e5cc57963a1ae45720a5ade66aad1598

commit a9f7f114e5cc57963a1ae45720a5ade66aad1598
Author:     Michael Gmelin <grembo@FreeBSD.org>
AuthorDate: 2022-10-05 13:12:39 +0000
Commit:     Michael Gmelin <grembo@FreeBSD.org>
CommitDate: 2022-10-05 16:27:28 +0000

    sysutils/vagrant: Respect hier(7) for networks.conf
    
    Since virtualbox-ose 6.1.26 there is a new networks.conf file
    which had originally been placed in /etc/vbox.
    
    In 66635b2061daf this was been corrected for emulators/virtualbox-ose,
    this change does the same for vagrant's virtualbox plugin.
    
    Before this change, networks.conf had to be put into two places
    (e.g., by symlinking /usr/local/etc/vbox to /etc/vbox).
    
    PR:             266845
    Approved by:    joe@thrallingpenguin.com (maintainer)
---
 sysutils/vagrant/Makefile                                     |  7 +++++--
 .../patch-plugins_providers_virtualbox_action_network.rb      | 11 +++++++++++
 sysutils/vagrant/files/patch-templates_locales_en.yml         | 11 +++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/sysutils/vagrant/Makefile b/sysutils/vagrant/Makefile
index bbd4d80e264f..2588a87151d8 100644
--- a/sysutils/vagrant/Makefile
+++ b/sysutils/vagrant/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	vagrant
 PORTVERSION=	2.2.19
 DISTVERSIONPREFIX=	v
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	sysutils rubygems devel
 
 MAINTAINER=	joe@thrallingpenguin.com
@@ -70,7 +70,10 @@ BASH_PLIST_FILES=	share/bash-completion/completions/vagrant
 ZSH_PLIST_FILES=	share/share/zsh/site-functions/_vagrant
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|@PREFIX@|${PREFIX}|g' ${WRKSRC}/bin/vagrant
+	@${REINPLACE_CMD} -e 's|@PREFIX@|${PREFIX}|g' \
+		${WRKSRC}/bin/vagrant \
+		${WRKSRC}/plugins/providers/virtualbox/action/network.rb \
+		${WRKSRC}/templates/locales/en.yml
 
 do-build:
 	(cd ${WRKSRC}; (${ECHO_CMD} -e "install:\n\techo\n") > Makefile)
diff --git a/sysutils/vagrant/files/patch-plugins_providers_virtualbox_action_network.rb b/sysutils/vagrant/files/patch-plugins_providers_virtualbox_action_network.rb
new file mode 100644
index 000000000000..b56e62d6909c
--- /dev/null
+++ b/sysutils/vagrant/files/patch-plugins_providers_virtualbox_action_network.rb
@@ -0,0 +1,11 @@
+--- plugins/providers/virtualbox/action/network.rb.orig	2021-11-05 21:15:44 UTC
++++ plugins/providers/virtualbox/action/network.rb
+@@ -18,7 +18,7 @@ module VagrantPlugins
+       class Network
+ 
+         # Location of the VirtualBox networks configuration file
+-        VBOX_NET_CONF = "/etc/vbox/networks.conf".freeze
++        VBOX_NET_CONF = "@PREFIX@/etc/vbox/networks.conf".freeze
+         # Version of VirtualBox that introduced hostonly network range restrictions
+         HOSTONLY_VALIDATE_VERSION = Gem::Version.new("6.1.28")
+         # Default valid range for hostonly networks
diff --git a/sysutils/vagrant/files/patch-templates_locales_en.yml b/sysutils/vagrant/files/patch-templates_locales_en.yml
new file mode 100644
index 000000000000..01d2cceffd37
--- /dev/null
+++ b/sysutils/vagrant/files/patch-templates_locales_en.yml
@@ -0,0 +1,11 @@
+--- templates/locales/en.yml.orig	2021-11-05 21:15:44 UTC
++++ templates/locales/en.yml
+@@ -1863,7 +1863,7 @@ en:
+           Address: %{address}
+           Ranges: %{ranges}
+ 
+-        Valid ranges can be modified in the /etc/vbox/networks.conf file. For
++        Valid ranges can be modified in the @PREFIX@/etc/vbox/networks.conf file. For
+         more information including valid format see:
+ 
+           https://www.virtualbox.org/manual/ch06.html#network_hostonly