-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall-fs-mount.ps1
More file actions
65 lines (53 loc) · 2.17 KB
/
install-fs-mount.ps1
File metadata and controls
65 lines (53 loc) · 2.17 KB
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
param(
[string]$RepoUrl = "https://github.com/DeanoC/Spiderweb.git",
[string]$DestDir = "$env:LOCALAPPDATA\Spiderweb\fs-mount-src",
[string]$InstallDir = "$env:LOCALAPPDATA\Programs\Spiderweb\bin"
)
$ErrorActionPreference = "Stop"
function Require-Command {
param([string]$Name)
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
throw "Missing required command: $Name"
}
}
function Test-WinFspInstalled {
if (Test-Path "$env:ProgramFiles(x86)\WinFsp\bin\winfsp-x64.dll") { return $true }
if (Test-Path "$env:ProgramFiles\WinFsp\bin\winfsp-x64.dll") { return $true }
return $false
}
Require-Command git
Require-Command zig
if (-not (Test-WinFspInstalled)) {
$winget = Get-Command winget -ErrorAction SilentlyContinue
if (-not $winget) {
throw "WinFSP is required and was not found. Install WinFSP manually, or install winget and rerun this script."
}
Write-Host "Installing WinFSP with winget..."
winget install --id WinFsp.WinFsp --accept-package-agreements --accept-source-agreements
if (-not (Test-WinFspInstalled)) {
throw "WinFSP installation could not be verified. Install WinFSP manually and rerun this script."
}
}
$destParent = Split-Path -Parent $DestDir
if (-not (Test-Path $destParent)) {
New-Item -ItemType Directory -Force -Path $destParent | Out-Null
}
if (Test-Path "$DestDir\.git") {
git -C $DestDir fetch --all --tags
git -C $DestDir pull --ff-only
git -C $DestDir submodule update --init --recursive
} else {
git clone --recurse-submodules $RepoUrl $DestDir
}
Push-Location $DestDir
try {
zig build fs-mount spiderweb-fs-helper
} finally {
Pop-Location
}
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
Copy-Item -Force "$DestDir\zig-out\bin\spiderweb-fs-mount.exe" "$InstallDir\spiderweb-fs-mount.exe"
Copy-Item -Force "$DestDir\zig-out\bin\spiderweb-fs-helper.exe" "$InstallDir\spiderweb-fs-helper.exe"
Write-Host "Installed spiderweb-fs-mount.exe and spiderweb-fs-helper.exe to $InstallDir"
Write-Host "Example:"
Write-Host " spiderweb-fs-mount.exe --namespace-url ws://host:18790/ --workspace-id ws-demo --mount-backend winfsp mount X:"