Files
topgrade/src/steps/os/macos.rs

52 lines
1.5 KiB
Rust
Raw Normal View History

2020-02-27 15:32:13 +02:00
use crate::execution_context::ExecutionContext;
2018-12-31 14:05:15 +02:00
use crate::executor::RunType;
2018-12-15 21:52:21 +02:00
use crate::terminal::print_separator;
2020-02-27 15:32:13 +02:00
use crate::utils::{require, PathExt};
use anyhow::Result;
2020-02-27 15:32:13 +02:00
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()
}
2018-06-28 12:16:54 +03:00
2020-02-27 20:28:50 +02:00
pub fn run_macports(ctx: &ExecutionContext) -> Result<()> {
require("port")?;
let sudo = ctx.sudo().as_ref().unwrap();
print_separator("MacPorts");
ctx.run_type().execute(sudo).args(&["port", "selfupdate"]).check_run()?;
ctx.run_type()
.execute(sudo)
.args(&["port", "-u", "upgrade", "outdated"])
.check_run()?;
if ctx.config().cleanup() {
ctx.run_type()
.execute(sudo)
.args(&["port", "-N", "reclaim"])
.check_run()?;
}
Ok(())
}
2020-01-28 16:22:17 +02:00
pub fn run_mas(run_type: RunType) -> Result<()> {
let mas = require("mas")?;
print_separator("macOS App Store");
run_type.execute(mas).arg("upgrade").check_run()
}
pub fn upgrade_macos(run_type: RunType) -> Result<()> {
2020-01-28 16:22:17 +02:00
print_separator("macOS system update");
2018-08-19 14:45:23 +03:00
2019-03-10 21:48:49 +02:00
run_type
.execute("softwareupdate")
.args(&["--install", "--all"])
.check_run()
2018-06-28 12:16:54 +03:00
}