blob: 5264d2ecb566c3b597ab983b5b16f08967275d23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!pwsh
#Requires -Version 6.0
<#
.SYNOPSIS
Installs the base box at the specified version from the share.
.PARAMETER FileshareMachine
The machine which is acting as a fileshare
.PARAMETER BoxVersion
The version of the box to add. Defaults to latest if nothing is passed.
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[String]$FileshareMachine,
[Parameter()]
[String]$BoxVersion
)
Set-StrictMode -Version 2
if (-not $IsMacOS) {
throw 'This script should only be run on a macOS host'
}
$mountPoint = '/Users/vcpkg/vagrant/share'
if (mount | grep "on $mountPoint (") {
umount $mountPoint
if (-not $?) {
Write-Error "umount $mountPoint failed with return code $LASTEXITCODE."
throw
}
}
sshfs "fileshare@${FileshareMachine}:/Users/fileshare/share" $mountPoint
if ($LASTEXITCODE -eq 1) {
Write-Error 'sshfs returned 1.
This means that the osxfuse kernel extension was not allowed to load.
You may need to force un/reinstall osxfuse and/or sshfs with
brew uninstall osxfuse
brew uninstall sshfs
brew install osxfuse
brew install sshfs
Then, rerun this script.
If you''ve already done that, Please open
System Preferences > Security & Privacy > General,
and allow the kernel extension to load.
Then, rerun this script.
If you''ve already done this, you probably need to add your ssh keys to the fileshare machine.'
throw
} elseif (-not $?) {
Write-Error "sshfs failed with return code $LASTEXITCODE."
throw
}
if (-not [String]::IsNullOrEmpty($BoxVersion)) {
$versionArgs = @("--box-version", $BoxVersion)
} else {
$versionArgs = @()
}
vagrant box add "$mountPoint/vcpkg-boxes/macos-ci.json" @versionArgs
|