Amethyst now checks for .pacnew and .pacsave files and prompts the user to run pacdiff if necessary
parent
92b7829fe1
commit
ab5e337012
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue