Skip to content

Commit 858139e

Browse files
committed
bashify
1 parent aa517b9 commit 858139e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

.github/actions/setup-imdisk/action.yaml

+26-26
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@ runs:
77
steps:
88
- name: Install OSFMount
99
if: runner.os == 'Windows'
10-
shell: pwsh
10+
shell: bash
1111
run: |
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
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
3334
env:
3435
OSFMOUNT_URL: https://storage.googleapis.com/coder-osfmount-binaries/osfmount-v3.1.1003.exe
3536
OSFMOUNT_SHA256: 9fe0738b7c2d29a7414e67f53aea359f3801d1c37b44f1b4fed5d02cb7536369
3637

3738
- name: Create RAM Disk
38-
shell: pwsh
39+
shell: bash
3940
run: |
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" }
41+
set -euo pipefail
42+
"/c/Program Files/OSFmount/OSFMount.com" -a -t vm -s 4096M -m R: -o logical,format:NTFS

0 commit comments

Comments
 (0)