tools: script to install podman on windows

the script may need a few other changes as my dev box already had
podman and potentially other dependencies. I uninstalled podman to test.

BUG=b:308883445
TEST=used script install on a dev box.

Change-Id: Ieb44587cc79b22952bc0c8154c9001f608e51769
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4998699
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
This commit is contained in:
Vikram Auradkar 2023-11-02 05:33:50 +00:00 committed by crosvm LUCI
parent 92e8988fd4
commit 39f462aad8

41
tools/install-podman.ps1 Normal file
View file

@ -0,0 +1,41 @@
<#
.Description
The script installs and sets up podman.
.PARAMETER BASE_DIR
Determines where the binaries will be downloaded. This defaults to user's temp directory.
#>
param (
[Parameter(
Position = 0
)]
[string]$BASE_DIR = $Env:TEMP ##
)
$BASE_DIR = $BASE_DIR + "\"
$PODMAN_VERSION = '4.7.2'
$PODMAN_SHA256 = "2124ac24e2c730f16e07e8eb033d5675d0f6123669c27d525d43d2f51f96b1ba"
$PODMAN_URL = "https://github.com/containers/podman/releases/download/v$PODMAN_VERSION/podman-$PODMAN_VERSION-setup.exe"
$PODMAN_SETUP = $BASE_DIR + 'podman-setup.exe'
$PODMAN_INSTALL_PATH = "C:\Program Files\RedHat\Podman\"
# Download podman
Invoke-WebRequest $PODMAN_URL -Out $PODMAN_SETUP
Write-Host "Verifying podman integrity"
if ((Get-FileHash $PODMAN_SETUP -Algorithm SHA256).Hash -ne $PODMAN_SHA256) {
Write-Host "$PODMAN_SETUP sha did not match"
Break
}
# Install podman
Write-Host "Installing podman. You may skip rebooting for machine for now"
Start-Process $PODMAN_SETUP /norestart -NoNewWindow -Wait
# Update PATH to contain podman directory.
$Env:PATH = $Env:PATH + ";" + $PODMAN_INSTALL_PATH
# create and start a wsl2 machine for podman to use
podman machine init
podman machine start
Write-Host "podman installed successfully. You may need to add $PODMAN_INSTALL_PATH to your PATH"