Skip to content

Commit

Permalink
Implementing a check for Windows 11 and, if detected, skipping Window…
Browse files Browse the repository at this point in the history
…s Update via usoclient.exe. It is suggested to install PSWindowsUpdate.
  • Loading branch information
niStee committed Jan 27, 2024
1 parent 43a4d32 commit e1ef2e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ merge = "~0.1"
regex-split = "~0.1"
notify-rust = "~4.10"
wildmatch = "2.3.0"
os_info = "3.7.0"

[package.metadata.generate-rpm]
assets = [{ source = "target/release/topgrade", dest = "/usr/bin/topgrade" }]
Expand Down
10 changes: 10 additions & 0 deletions src/steps/os/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use crate::utils::{require, which};
use crate::{error::SkipStep, steps::git::Repositories};
use crate::{powershell, Step};

use os_info;

pub fn run_chocolatey(ctx: &ExecutionContext) -> Result<()> {
let choco = require("choco")?;
let yes = ctx.config().yes(Step::Chocolatey);
Expand Down Expand Up @@ -212,6 +214,14 @@ pub fn windows_update(ctx: &ExecutionContext) -> Result<()> {
return powershell.windows_update(ctx);
}

let info: os_info::Info = os_info::get();
let edition: String = info.edition().unwrap_or("Unknown").to_string();
if edition.contains("Windows 11") {
print_separator("Windows Update");
println!("Windows 11 does not support Windows Update via usoclient.exe. Consider installing PSWindowsUpdate");
return Ok(());
}

let usoclient = require("UsoClient")?;

print_separator("Windows Update");
Expand Down

0 comments on commit e1ef2e4

Please sign in to comment.