1 <# 2 .Description 3 The script installs and sets up podman. 4 .PARAMETER BASE_DIR 5 Determines where the binaries will be downloaded. This defaults to user's temp directory. 6 #> 7 param ( 8 [Parameter( 9 Position = 0 10 )] 11 [string]$BASE_DIR = $Env:TEMP ## 12 ) 13 14 $BASE_DIR = $BASE_DIR + "\" 15 $PODMAN_VERSION = '4.7.2' 16 $PODMAN_SHA256 = "2124ac24e2c730f16e07e8eb033d5675d0f6123669c27d525d43d2f51f96b1ba" 17 $PODMAN_URL = "https://github.com/containers/podman/releases/download/v$PODMAN_VERSION/podman-$PODMAN_VERSION-setup.exe" 18 $PODMAN_SETUP = $BASE_DIR + 'podman-setup.exe' 19 $PODMAN_INSTALL_PATH = "C:\Program Files\RedHat\Podman\" 20 21 # Download podman 22 Invoke-WebRequest $PODMAN_URL -Out $PODMAN_SETUP 23 Write-Host "Verifying podman integrity" 24 if ((Get-FileHash $PODMAN_SETUP -Algorithm SHA256).Hash -ne $PODMAN_SHA256) { 25 Write-Host "$PODMAN_SETUP sha did not match" 26 Break 27 } 28 29 # Install podman 30 Write-Host "Installing podman. You may skip rebooting for machine for now" 31 Start-Process $PODMAN_SETUP /norestart -NoNewWindow -Wait 32 33 # Update PATH to contain podman directory. 34 $Env:PATH = $Env:PATH + ";" + $PODMAN_INSTALL_PATH 35 36 # create and start a wsl2 machine for podman to use 37 podman machine init 38 podman machine start 39 40 41 Write-Host "podman installed successfully. You may need to add $PODMAN_INSTALL_PATH to your PATH" 42