mirror of
https://github.com/r-darwish/topgrade
synced 2024-07-08 20:16:24 +00:00
* Don't call gnome shell extensions if it's not registered in dbus (fix #835) * fix * Execute-elevated (#892) * Introduce the execute elevated method (fix #885) * fmt * Fix nix with doas * Bad import * No gnome in macOS * Unused imports
This commit is contained in:
parent
9ed518c82a
commit
d0e1212700
|
@ -280,6 +280,7 @@ fn run() -> Result<()> {
|
|||
runner.execute(Step::Tmux, "tmux", || tmux::run_tpm(&base_dirs, run_type))?;
|
||||
runner.execute(Step::Tldr, "TLDR", || unix::run_tldr(run_type))?;
|
||||
runner.execute(Step::Pearl, "pearl", || unix::run_pearl(run_type))?;
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
runner.execute(Step::GnomeShellExtensions, "Gnome Shell Extensions", || {
|
||||
unix::upgrade_gnome_extensions(&ctx)
|
||||
})?;
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
use crate::error::SkipStep;
|
||||
use crate::error::TopgradeError;
|
||||
use crate::execution_context::ExecutionContext;
|
||||
#[cfg(target_os = "macos")]
|
||||
use crate::executor::CommandExt;
|
||||
use crate::executor::{Executor, ExecutorExitStatus, RunType};
|
||||
use crate::executor::{CommandExt, Executor, ExecutorExitStatus, RunType};
|
||||
use crate::terminal::print_separator;
|
||||
use crate::utils::{require, require_option, PathExt};
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
use crate::utils::require_option;
|
||||
use crate::utils::{require, PathExt};
|
||||
use crate::Step;
|
||||
use anyhow::Result;
|
||||
use directories::BaseDirs;
|
||||
|
@ -135,12 +135,31 @@ pub fn run_fish_plug(ctx: &ExecutionContext) -> Result<()> {
|
|||
ctx.run_type().execute(&fish).args(&["-c", "plug update"]).check_run()
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub fn upgrade_gnome_extensions(ctx: &ExecutionContext) -> Result<()> {
|
||||
let gdbus = require("gdbus")?;
|
||||
require_option(
|
||||
env::var("XDG_CURRENT_DESKTOP").ok().filter(|p| p.contains("GNOME")),
|
||||
"Desktop doest not appear to be gnome".to_string(),
|
||||
)?;
|
||||
let output = Command::new("gdbus")
|
||||
.args(&[
|
||||
"call",
|
||||
"--session",
|
||||
"--dest",
|
||||
"org.freedesktop.DBus",
|
||||
"--object-path",
|
||||
"/org/freedesktop/DBus",
|
||||
"--method",
|
||||
"org.freedesktop.DBus.ListActivatableNames",
|
||||
])
|
||||
.check_output()?;
|
||||
|
||||
debug!("Checking for gnome extensions: {}", output);
|
||||
if !output.contains("org.gnome.Shell.Extensions") {
|
||||
return Err(SkipStep(String::from("Gnome shell extensions are unregistered in DBus")).into());
|
||||
}
|
||||
|
||||
print_separator("Gnome Shell extensions");
|
||||
|
||||
ctx.run_type()
|
||||
|
|
Loading…
Reference in New Issue
Block a user