Amethyst now checks for .pacnew and .pacsave files and prompts the user to run pacdiff if necessary

i18n
Michal 2 years ago
parent 92b7829fe1
commit ab5e337012

@ -28,6 +28,10 @@ impl ShellCommand {
}
}
pub fn pacdiff() -> Self {
Self::new("pacdiff")
}
pub fn makepkg() -> Self {
Self::new("makepkg")
}

@ -1,9 +1,26 @@
use crate::internal::strings::info;
use crate::internal::strings::prompt;
use crate::internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
use crate::internal::commands::ShellCommand;
pub fn detect(a: String) {
if a.contains(".pacnew") || a.contains(".new") {
info("It appears that a program you have installed / upgraded has installed a .new/.pacnew config file. Please read over the pacman output and act on it accordingly".to_string());
} else if a.contains(".old") {
info("It appears that a program you have installed / upgraded has installed a .old config file. Please read over the pacman output and act on it accordingly".to_string());
pub fn detect() {
let mut pacnew = vec![];
for entry in std::fs::read_dir("/etc").unwrap() {
let entry = entry.unwrap();
let path = entry.path();
if path.to_str().unwrap().contains(".pacnew") || path.to_str().unwrap().contains(".pacsave") {
pacnew.push(path);
}
}
if !pacnew.is_empty() {
let choice = prompt("It appears that at least one program you have installed / upgraded has installed a .pacnew/.pacsave config file. Would you like to run pacdiff to deal with this?".to_string(), true);
if choice {
ShellCommand::pacdiff()
.elevated()
.wait()
.silent_unwrap(AppExitCode::PacmanError);
}
}
}

@ -7,12 +7,14 @@ pub mod rpc;
mod sort;
mod strings;
pub mod structs;
mod detect;
pub use clean::*;
pub use initialise::*;
pub use sort::*;
use std::env;
pub use strings::*;
pub use detect::*;
#[macro_export]
macro_rules! uwu {

@ -8,6 +8,7 @@ use internal::error::SilentUnwrap;
use crate::internal::exit_code::AppExitCode;
#[allow(unused_imports)]
use crate::internal::{crash, info, init, log, prompt, sort, structs::Options, warn};
use crate::internal::detect;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
@ -49,6 +50,8 @@ fn main() {
operations::clean(options);
}
}
detect();
}
fn cmd_install(args: InstallArgs, options: Options) {

Loading…
Cancel
Save