1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2025-04-01 23:57:05 +00:00
mailinabox/tests/vagrant/funcs.rb
2023-05-29 19:45:27 -04:00

26 lines
1.1 KiB
Ruby

#####
##### This file is part of Mail-in-a-Box-LDAP which is released under the
##### terms of the GNU Affero General Public License as published by the
##### Free Software Foundation, either version 3 of the License, or (at
##### your option) any later version. See file LICENSE or go to
##### https://github.com/downtownallday/mailinabox-ldap for full license
##### details.
#####
def use_preloaded_box(obj, name, preloaded_dir=".")
obj.vm.box = String.new(name)
_name=name.sub! '/','-' # ubuntu/bionic64 => ubuntu-bionic64
if File.file?("#{preloaded_dir}/preloaded/preloaded-#{_name}.box")
# box name needs to be unique on the system
obj.vm.box = "preloaded-miabldap-#{_name}"
obj.vm.box_url = "file://" + Dir.pwd + "/#{preloaded_dir}/preloaded/preloaded-#{_name}.box"
if Vagrant.has_plugin?('vagrant-vbguest')
# do not update additions when booting this machine
obj.vbguest.auto_update = false
end
end
end
# Grab the name of the default interface
$default_network_interface = `ip route | awk '/^default/ {printf "%s", $5; exit 0}'`