Created
April 4, 2016 12:45
-
-
Save NeroBurner/bb853b4643056b40ae53e15dead13f00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> default: Mounting shared folders... | |
INFO interface: detail: /vagrant => /home/gc/Downloads/Vagrant/win7_test | |
INFO interface: detail: default: /vagrant => /home/gc/Downloads/Vagrant/win7_test | |
default: /vagrant => /home/gc/Downloads/Vagrant/win7_test | |
INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dae74697-9457-489d-b155-f339d3997b4e", "--machinereadable"] | |
INFO subprocess: Command not in installer, restoring original environment... | |
INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dae74697-9457-489d-b155-f339d3997b4e", "--machinereadable"] | |
INFO subprocess: Command not in installer, restoring original environment... | |
INFO ssh: SSH is ready! | |
INFO ssh: Execute: (sudo=false) | |
INFO guest: Execute capability: mount_virtualbox_shared_folder [#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>, "vagrant", "/vagrant", {:guestpath=>"/vagrant", :hostpath=>"/home/gc/Downloads/Vagrant/win7_test", :disabled=>false, :__vagrantfile=>true, :owner=>"vagrant", :group=>"vagrant"}] (windows) | |
INFO ssh: Execute: function Test-ReparsePoint([string]$path) { | |
$file = Get-Item $path -Force -ea 0 | |
return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint) | |
} | |
$MountPoint = [System.IO.Path]::GetFullPath("/vagrant") | |
$ShareName = "vagrant" | |
$VmProviderUncPath = "\\vboxsrv\vagrant" | |
# https://github.com/BIAINC/vagrant-windows/issues/4 | |
# Not sure why this works, but it does. | |
& net use $ShareName 2>&1 | Out-Null | |
Write-Debug "Attempting to mount $ShareName to $MountPoint" | |
if( (Test-Path "$MountPoint") -and (Test-ReparsePoint "$MountPoint") ) | |
{ | |
Write-Debug "Junction already exists, so I will delete it" | |
# Powershell refuses to delete junctions, oh well use cmd | |
cmd /c rd "$MountPoint" | |
if ( $LASTEXITCODE -ne 0 ) | |
{ | |
Write-Error "Failed to delete symbolic link at $MountPoint" | |
exit 1 | |
} | |
} | |
elseif(Test-Path $MountPoint) | |
{ | |
Write-Debug "Mount point already exists and is not a symbolic link" | |
exit 1 | |
} | |
$BaseDirectory = [System.IO.Path]::GetDirectoryName($MountPoint) | |
if (-not (Test-Path $BaseDirectory)) | |
{ | |
Write-Debug "Creating parent directory for mount point $BaseDirectory" | |
New-Item $BaseDirectory -Type Directory -Force | Out-Null | |
} | |
cmd /c mklink /D "$MountPoint" "$VmProviderUncPath" | out-null | |
if ( $LASTEXITCODE -ne 0 ) | |
{ | |
exit 1 | |
} | |
(sudo=false) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment