Microsoft update for macOS (fix #344)

This commit is contained in:
Roey Darwish Dror
2020-02-27 15:32:13 +02:00
committed by GitHub
parent 20a923a9c0
commit 2b89f87a37
2 changed files with 14 additions and 1 deletions

View File

@@ -363,6 +363,7 @@ fn run() -> Result<()> {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
if config.should_run(Step::System) { if config.should_run(Step::System) {
runner.execute("Microsoft AutoUpdate", || macos::run_msupdate(&ctx))?;
runner.execute("App Store", || macos::run_mas(run_type))?; runner.execute("App Store", || macos::run_mas(run_type))?;
runner.execute("System upgrade", || macos::upgrade_macos(run_type))?; runner.execute("System upgrade", || macos::upgrade_macos(run_type))?;
} }

View File

@@ -1,7 +1,19 @@
use crate::execution_context::ExecutionContext;
use crate::executor::RunType; use crate::executor::RunType;
use crate::terminal::print_separator; use crate::terminal::print_separator;
use crate::utils::require; use crate::utils::{require, PathExt};
use anyhow::Result; use anyhow::Result;
use std::path::Path;
pub fn run_msupdate(ctx: &ExecutionContext) -> Result<()> {
let msupdate =
Path::new("/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app/Contents/MacOS/msupdate")
.require()?;
print_separator("Microsoft AutoUpdate");
ctx.run_type().execute(msupdate).arg("--list").check_run()?;
ctx.run_type().execute(msupdate).arg("--install").check_run()
}
pub fn run_mas(run_type: RunType) -> Result<()> { pub fn run_mas(run_type: RunType) -> Result<()> {
let mas = require("mas")?; let mas = require("mas")?;