mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
tools: deploy: hyper-v support
This commit is contained in:
parent
675ecf2e51
commit
89aaf33b62
0
tools/build-choco.bat
Normal file → Executable file
0
tools/build-choco.bat
Normal file → Executable file
@ -1,21 +1,21 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
set CONFIG=Debug
|
set Config=Debug
|
||||||
set SUFFIX=x64
|
set Suffix=x64
|
||||||
set TARGET_MACHINE=WIN8DBG
|
set Deploy=C:\Deploy\winfsp
|
||||||
if not X%1==X set TARGET_MACHINE=%1
|
set Target=Win10DBG
|
||||||
set TARGET_ACCOUNT=\Users\%USERNAME%\Downloads\winfsp\
|
if not X%1==X set Target=%1
|
||||||
set TARGET=\\%TARGET_MACHINE%%TARGET_ACCOUNT%
|
|
||||||
|
|
||||||
cd %~dp0..
|
set Files=
|
||||||
mkdir %TARGET% 2>nul
|
for %%f in (winfsp-%Suffix%.sys winfsp-%Suffix%.dll winfsp-tests-%Suffix%.exe memfs-%Suffix%.exe) do (
|
||||||
for %%f in (winfsp-%SUFFIX%.sys winfsp-%SUFFIX%.dll winfsp-tests-%SUFFIX%.exe fsbench-%SUFFIX%.exe fscrash-%SUFFIX%.exe memfs-%SUFFIX%.exe) do (
|
if [!Files!] == [] (
|
||||||
copy build\VStudio\build\%CONFIG%\%%f %TARGET% >nul
|
set Files='%~dp0..\build\VStudio\build\%Config%\%%f'
|
||||||
|
) else (
|
||||||
|
set Files=!Files!,'%~dp0..\build\VStudio\build\%Config%\%%f'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
copy tools\ifstest.bat %TARGET% >nul
|
|
||||||
echo sc create WinFsp type=filesys binPath=%%~dp0winfsp-%SUFFIX%.sys >%TARGET%sc-create.bat
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0deploy.ps1' -Name '%Target%' -Files !Files! -Destination '%Deploy%'"
|
||||||
echo sc start WinFsp >%TARGET%sc-start.bat
|
|
||||||
echo sc stop WinFsp >%TARGET%sc-stop.bat
|
|
||||||
echo sc delete WinFsp >%TARGET%sc-delete.bat
|
|
||||||
|
35
tools/deploy.ps1
Normal file
35
tools/deploy.ps1
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
param (
|
||||||
|
[Parameter(Mandatory)][string]$Name,
|
||||||
|
[string]$CheckpointName,
|
||||||
|
[Parameter(Mandatory)][string[]]$Files,
|
||||||
|
[Parameter(Mandatory)][string]$Destination
|
||||||
|
)
|
||||||
|
|
||||||
|
function Restore-VM ($Name, $CheckpointName) {
|
||||||
|
$VM = Get-VM -Name $Name
|
||||||
|
if ($VM.State -eq "Running") {
|
||||||
|
Stop-VM -Name $Name -TurnOff
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $CheckpointName) {
|
||||||
|
$Checkpoint = Get-VMCheckpoint -VMName $Name |
|
||||||
|
Sort-Object -Property CreationTime -Descending |
|
||||||
|
select -First 1
|
||||||
|
} else {
|
||||||
|
$Checkpoint = Get-VMCheckpoint -VMName $Name -Name $CheckpointName
|
||||||
|
}
|
||||||
|
Restore-VMCheckpoint -VMCheckpoint $Checkpoint -Confirm:$false
|
||||||
|
|
||||||
|
Start-VM -Name $Name
|
||||||
|
}
|
||||||
|
|
||||||
|
function Deploy-VMFiles ($Name, $Files, $Destination) {
|
||||||
|
foreach ($File in $Files) {
|
||||||
|
$Leaf = Split-Path -Path $File -Leaf
|
||||||
|
$Dest = Join-Path $Destination $Leaf
|
||||||
|
Copy-VMFile -Name $Name -SourcePath $File -DestinationPath $Dest -FileSource Host -CreateFullPath -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Restore-VM -Name $Name -CheckpointName $CheckpointName
|
||||||
|
Deploy-VMFiles -Name $Name -Files $Files -Destination $Destination
|
Loading…
x
Reference in New Issue
Block a user