|
7 | 7 | steps:
|
8 | 8 | - name: Install OSFMount
|
9 | 9 | if: runner.os == 'Windows'
|
10 |
| - shell: bash |
| 10 | + shell: pwsh |
11 | 11 | run: |
|
12 |
| - set -euo pipefail |
13 |
| - curl \ |
14 |
| - --progress-bar \ |
15 |
| - --show-error \ |
16 |
| - --fail \ |
17 |
| - --location \ |
18 |
| - --output ./osfmount.exe \ |
19 |
| - "$OSFMOUNT_URL" |
20 |
| -
|
21 |
| - download_hash=$(sha256sum ./osfmount.exe | awk '{ print $1 }') |
22 |
| - if [ "$download_hash" != "$OSFMOUNT_SHA256" ]; then |
23 |
| - echo "Failed to verify osfmount.exe" |
24 |
| - echo "Expected: $OSFMOUNT_SHA256" |
25 |
| - echo "Got: $download_hash" |
26 |
| - exit 1 |
27 |
| - fi |
28 |
| -
|
29 |
| - ./osfmount.exe //silent //norestart |
30 |
| - # Close the GUI (which gets autolaunched and can't be disabled) and |
31 |
| - # delete the installer. |
32 |
| - taskkill //IM "OSFMount.exe" //F |
33 |
| - rm -f osfmount.exe |
| 12 | + $ErrorActionPreference = "Stop" |
| 13 | + $path = "$($env:TEMP)\osfmount.exe" |
| 14 | + & curl.exe ` |
| 15 | + --progress-bar ` |
| 16 | + --show-error ` |
| 17 | + --fail ` |
| 18 | + --location ` |
| 19 | + --output $path ` |
| 20 | + $env:OSFMOUNT_URL |
| 21 | + if ($LASTEXITCODE -ne 0) { throw "Failed to download osfmount.exe" } |
| 22 | + if ((Get-FileHash $path -Algorithm SHA256).Hash -ne $env:OSFMOUNT_SHA256) { |
| 23 | + throw "Failed to verify osfmount.exe" |
| 24 | + } |
| 25 | + # We can't just use -Wait here or it will block when the installer |
| 26 | + # launches the GUI afterwards, and there's no way to turn that off. |
| 27 | + $proc = Start-Process -FilePath $path -ArgumentList "/silent /norestart" -PassThru |
| 28 | + $proc.WaitForExit() |
| 29 | + if ($proc.ExitCode -ne 0) { throw "Failed to install osfmount.exe" } |
| 30 | + # Close the GUI and delete the installer. |
| 31 | + Get-Process -Name "OSFMount" -ErrorAction SilentlyContinue | Stop-Process -Force |
| 32 | + Remove-Item $path |
34 | 33 | env:
|
35 | 34 | OSFMOUNT_URL: https://storage.googleapis.com/coder-osfmount-binaries/osfmount-v3.1.1003.exe
|
36 | 35 | OSFMOUNT_SHA256: 9fe0738b7c2d29a7414e67f53aea359f3801d1c37b44f1b4fed5d02cb7536369
|
37 | 36 |
|
38 | 37 | - name: Create RAM Disk
|
39 |
| - shell: bash |
| 38 | + shell: pwsh |
40 | 39 | run: |
|
41 |
| - set -euo pipefail |
42 |
| - "/c/Program Files/OSFmount/OSFMount.com" -a -t vm -s 4096M -m R: -o hd,format:NTFS |
| 40 | + $ErrorActionPreference = "Stop" |
| 41 | + & "C:\Program Files\OSFmount\OSFMount.com" -a -s 4096M -m R: -o logical,format:NTFS |
| 42 | + if ($LASTEXITCODE -ne 0) { throw "Failed to create RAM disk" } |
0 commit comments