Sha256: caaaa8ffe69a0bf83f11f00394439247c836121b9fe5ad3f411a6c3773da2e6f

Contents?: true

Size: 1001 Bytes

Versions: 1

Compression:

Stored size: 1001 Bytes

Contents

require 'shellwords'

module VagrantPlugins
  module Parallels
    module Util
      module Common

        # Determines whether the VM's box contains a macOS guest for an Apple Silicon host.
        # In this case the image file ends with '.macvm' instead of '.pvm'
        def self.is_macvm(machine)
          return !machine.box.nil? && !!Dir.glob(machine.box.directory.join('*.macvm')).first
        end

        # Determines if the box directory is on an APFS filesystem
        def self.is_apfs?(path, &block)
            output = {stdout: '', stderr: ''}
            df_command = %w[df -T apfs]
            df_command << Shellwords.escape(path)
            execute(*df_command, &block).exit_code == 0
        end

        private

        def self.execute(*command, &block)
          command << { notify: [:stdout, :stderr] }

          Vagrant::Util::Busy.busy(lambda {}) do
            Vagrant::Util::Subprocess.execute(*command, &block)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-parallels-2.4.1 lib/vagrant-parallels/util/common.rb