From 13ed899d7d03049040792cf38a7e38c8a6974de9 Mon Sep 17 00:00:00 2001 From: Hayden Barnes Date: Tue, 30 Jan 2024 10:44:40 -0500 Subject: [PATCH] Add -check to wsl-latest-kernel --- README.md | 2 ++ wsl-latest-kernel.ps1 | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f81188..bbd958a 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Downloads, builds, and installs the latest kernel release from WSL2-Linux-Kernel `wsl-latest-kernel` - Run wsl-latest-kernel. +`wsl-latest-kernel -check` - Check for an available kernel updates. + `wsl-latest-kernel -force` - Overwrites the existing custom kernel. `wsl-latest-kernel -customconfig kernelconfig` - Build the kernel with a custom kernel config file. Expects a Windows path. diff --git a/wsl-latest-kernel.ps1 b/wsl-latest-kernel.ps1 index 4be5f7c..34210b5 100644 --- a/wsl-latest-kernel.ps1 +++ b/wsl-latest-kernel.ps1 @@ -3,7 +3,8 @@ param( [switch]$force, [string]$customConfig, [switch]$skipClean, - [switch]$revert + [switch]$revert, + [switch]$check ) # Function to convert a Windows path to a WSL path @@ -57,6 +58,10 @@ if ($latestRelease.tag_name -eq $wslKernelVersion) { Exit 1 } +if ($check) { + Exit 0 +} + # Run a persistent process in the wsl-system distro to prevent it from shutting down and resetting the environment $job = Start-Job -ScriptBlock { wsl --system --user root sh -c "while true; do sleep 1000; done"