Implementing a check for Windows 11 and, if detected, skipping Windows Update via usoclient.exe. It is suggested to install PSWindowsUpdate.
This commit is contained in:
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -1490,6 +1490,17 @@ dependencies = [
|
|||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_info"
|
||||||
|
version = "3.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"serde",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "overload"
|
name = "overload"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@@ -2405,6 +2416,7 @@ dependencies = [
|
|||||||
"nix 0.27.1",
|
"nix 0.27.1",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"os_info",
|
||||||
"parselnk",
|
"parselnk",
|
||||||
"regex",
|
"regex",
|
||||||
"regex-split",
|
"regex-split",
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ merge = "~0.1"
|
|||||||
regex-split = "~0.1"
|
regex-split = "~0.1"
|
||||||
notify-rust = "~4.10"
|
notify-rust = "~4.10"
|
||||||
wildmatch = "2.3.0"
|
wildmatch = "2.3.0"
|
||||||
|
os_info = "3.7.0"
|
||||||
|
|
||||||
[package.metadata.generate-rpm]
|
[package.metadata.generate-rpm]
|
||||||
assets = [{ source = "target/release/topgrade", dest = "/usr/bin/topgrade" }]
|
assets = [{ source = "target/release/topgrade", dest = "/usr/bin/topgrade" }]
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ use crate::utils::{require, which};
|
|||||||
use crate::{error::SkipStep, steps::git::Repositories};
|
use crate::{error::SkipStep, steps::git::Repositories};
|
||||||
use crate::{powershell, Step};
|
use crate::{powershell, Step};
|
||||||
|
|
||||||
|
use os_info;
|
||||||
|
|
||||||
pub fn run_chocolatey(ctx: &ExecutionContext) -> Result<()> {
|
pub fn run_chocolatey(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let choco = require("choco")?;
|
let choco = require("choco")?;
|
||||||
let yes = ctx.config().yes(Step::Chocolatey);
|
let yes = ctx.config().yes(Step::Chocolatey);
|
||||||
@@ -212,6 +214,14 @@ pub fn windows_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
return powershell.windows_update(ctx);
|
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")?;
|
let usoclient = require("UsoClient")?;
|
||||||
|
|
||||||
print_separator("Windows Update");
|
print_separator("Windows Update");
|
||||||
|
|||||||
Reference in New Issue
Block a user