Sparkle for updates (#950)
This commit is contained in:
committed by
GitHub
parent
4a7de60e59
commit
4e6f48caef
@@ -1,9 +1,10 @@
|
||||
use crate::execution_context::ExecutionContext;
|
||||
use crate::executor::RunType;
|
||||
use crate::executor::{CommandExt, RunType};
|
||||
use crate::terminal::{print_separator, prompt_yesno};
|
||||
use crate::{error::TopgradeError, utils::require, Step};
|
||||
use anyhow::Result;
|
||||
use log::debug;
|
||||
use std::fs;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn run_macports(ctx: &ExecutionContext) -> Result<()> {
|
||||
@@ -72,3 +73,23 @@ fn system_update_available() -> Result<bool> {
|
||||
debug!("{:?}", string_output);
|
||||
Ok(!string_output.contains("No new software available"))
|
||||
}
|
||||
|
||||
pub fn run_sparkle(ctx: &ExecutionContext) -> Result<()> {
|
||||
let sparkle = require("sparkle")?;
|
||||
|
||||
print_separator("Sparkle");
|
||||
|
||||
for application in (fs::read_dir("/Applications")?).flatten() {
|
||||
let probe = Command::new(&sparkle)
|
||||
.args(&["--probe", "--application"])
|
||||
.arg(application.path())
|
||||
.check_output();
|
||||
if probe.is_ok() {
|
||||
let mut command = ctx.run_type().execute(&sparkle);
|
||||
command.args(&["bundle", "--check-immediately", "--application"]);
|
||||
command.arg(application.path());
|
||||
command.spawn()?.wait()?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user