From 39f462aad8f71f22c6c5115ccb85d5c76c278f1d Mon Sep 17 00:00:00 2001 From: Vikram Auradkar Date: Thu, 2 Nov 2023 05:33:50 +0000 Subject: [PATCH] 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 Commit-Queue: Vikram Auradkar Auto-Submit: Vikram Auradkar --- tools/install-podman.ps1 | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tools/install-podman.ps1 diff --git a/tools/install-podman.ps1 b/tools/install-podman.ps1 new file mode 100644 index 0000000000..a1e542a9cc --- /dev/null +++ b/tools/install-podman.ps1 @@ -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"