From 98f70d4d7aa504dda5d3d10f8bdc4e92a74d81f0 Mon Sep 17 00:00:00 2001 From: Aloz1 Date: Thu, 12 Jul 2018 08:40:33 +1000 Subject: [PATCH] Add void linux host support --- plugins/hosts/void/cap/nfs.rb | 19 +++++++++++++++++++ plugins/hosts/void/host.rb | 22 ++++++++++++++++++++++ plugins/hosts/void/plugin.rb | 30 ++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 plugins/hosts/void/cap/nfs.rb create mode 100644 plugins/hosts/void/host.rb create mode 100644 plugins/hosts/void/plugin.rb diff --git a/plugins/hosts/void/cap/nfs.rb b/plugins/hosts/void/cap/nfs.rb new file mode 100644 index 000000000..a0d0fac91 --- /dev/null +++ b/plugins/hosts/void/cap/nfs.rb @@ -0,0 +1,19 @@ +module VagrantPlugins + module HostVoid + module Cap + class NFS + def self.nfs_check_command(env) + "/usr/bin/sv status nfs-server" + end + + def self.nfs_start_command(env) + "/usr/bin/sv up nfs-server " + end + + def self.nfs_installed(env) + Kernel.system("/usr/bin/xbps-query nfs-utils", [:out, :err] => "/dev/null") + end + end + end + end +end diff --git a/plugins/hosts/void/host.rb b/plugins/hosts/void/host.rb new file mode 100644 index 000000000..ea22c9b6a --- /dev/null +++ b/plugins/hosts/void/host.rb @@ -0,0 +1,22 @@ +require 'pathname' + +require 'vagrant' + +module VagrantPlugins + module HostVoid + class Host < Vagrant.plugin("2", :host) + def detect?(env) + os_file = Pathname.new("/etc/os-release") + + if os_file.exist? + file = os_file.open + while (line = file.gets) do + return true if line =~ /^ID="void"/ + end + end + + false + end + end + end +end diff --git a/plugins/hosts/void/plugin.rb b/plugins/hosts/void/plugin.rb new file mode 100644 index 000000000..4b297ab73 --- /dev/null +++ b/plugins/hosts/void/plugin.rb @@ -0,0 +1,30 @@ +require "vagrant" + +module VagrantPlugins + module HostVoid + class Plugin < Vagrant.plugin("2") + name "Void host" + description "Void linux host support." + + host("void", "linux") do + require_relative "host" + Host + end + + host_capability("void", "nfs_installed") do + require_relative "cap/nfs" + Cap::NFS + end + + host_capability("void", "nfs_check_command") do + require_relative "cap/nfs" + Cap::NFS + end + + host_capability("void", "nfs_start_command") do + require_relative "cap/nfs" + Cap::NFS + end + end + end +end