mount_vmware_shared_folder.rb (vagrant-2.2.13) | : | mount_vmware_shared_folder.rb (vagrant-2.2.14) | ||
---|---|---|---|---|
require "securerandom" | require "securerandom" | |||
module VagrantPlugins | module VagrantPlugins | |||
module GuestDarwin | module GuestDarwin | |||
module Cap | module Cap | |||
class MountVmwareSharedFolder | class MountVmwareSharedFolder | |||
MACOS_BIGSUR_DARWIN_VERSION = 20.freeze | ||||
# Entry point for hook to called delayed actions | # Entry point for hook to called delayed actions | |||
# which finalizing the synced folders setup on | # which finalizing the synced folders setup on | |||
# the guest | # the guest | |||
def self.write_apfs_firmlinks(env) | def self.write_apfs_firmlinks(env) | |||
if env && env[:machine] && delayed = apfs_firmlinks_delayed.delete(env [:machine].id) | if env && env[:machine] && delayed = apfs_firmlinks_delayed.delete(env [:machine].id) | |||
delayed.call | delayed.call | |||
end | end | |||
end | end | |||
# @return [Hash] storage location for delayed actions | # @return [Hash] storage location for delayed actions | |||
skipping to change at line 84 | skipping to change at line 87 | |||
if !comm.test("[[ \"$(</etc/synthetic.conf)\" = *\"#{share_line}\" * ]]") | if !comm.test("[[ \"$(</etc/synthetic.conf)\" = *\"#{share_line}\" * ]]") | |||
@apply_firmlinks[machine.id][:bootstrap] = true | @apply_firmlinks[machine.id][:bootstrap] = true | |||
end | end | |||
# If we haven't already added our hook to apply firmlinks, do it n ow | # If we haven't already added our hook to apply firmlinks, do it n ow | |||
if @apply_firmlinks[machine.id][:content].empty? | if @apply_firmlinks[machine.id][:content].empty? | |||
apfs_firmlinks_delayed[machine.id] = proc do | apfs_firmlinks_delayed[machine.id] = proc do | |||
content = @apply_firmlinks[machine.id][:content].join("\n") | content = @apply_firmlinks[machine.id][:content].join("\n") | |||
# Write out the synthetic file | # Write out the synthetic file | |||
comm.sudo("echo -e #{content.inspect} > /etc/synthetic.conf") | comm.sudo("echo -e #{content.inspect} > /etc/synthetic.conf") | |||
if @apply_firmlinks[:bootstrap] | if @apply_firmlinks[machine.id][:bootstrap] | |||
if machine.guest.capability("darwin_major_version").to_i < M | ||||
ACOS_BIGSUR_DARWIN_VERSION | ||||
apfs_bootstrap_flag = "-B" | ||||
expected_rc = 0 | ||||
else | ||||
apfs_bootstrap_flag = "-t" | ||||
expected_rc = 253 | ||||
end | ||||
# Re-bootstrap the root container to pick up firmlink update s | # Re-bootstrap the root container to pick up firmlink update s | |||
comm.sudo("/System/Library/Filesystems/apfs.fs/Contents/Reso urces/apfs.util -B") | comm.sudo("/System/Library/Filesystems/apfs.fs/Contents/Reso urces/apfs.util #{apfs_bootstrap_flag}", good_exit: [expected_rc]) | |||
end | end | |||
end | end | |||
end | end | |||
@apply_firmlinks[machine.id][:content] << share_line | @apply_firmlinks[machine.id][:content] << share_line | |||
end | end | |||
end | end | |||
end | end | |||
# Check if firmlink is provided by the system | # Check if firmlink is provided by the system | |||
# | # | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 13 lines changed or added |