|
|
|
@ -1,19 +1,23 @@
|
|
|
|
|
use crate::internal::commands::ShellCommand;
|
|
|
|
|
use crate::internal::error::SilentUnwrap;
|
|
|
|
|
use crate::internal::exit_code::AppExitCode;
|
|
|
|
|
use crate::{prompt, warn};
|
|
|
|
|
use crate::{prompt, warn, info};
|
|
|
|
|
|
|
|
|
|
pub fn detect() {
|
|
|
|
|
info!("Scanning for pacnew files");
|
|
|
|
|
|
|
|
|
|
let mut pacnew = vec![];
|
|
|
|
|
|
|
|
|
|
// Detect pacnew files
|
|
|
|
|
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")
|
|
|
|
|
{
|
|
|
|
|
// If found, push to vector
|
|
|
|
|
pacnew.push(path);
|
|
|
|
|
// Run `find` to find pacnew files and split by lines into a vec
|
|
|
|
|
let find = std::process::Command::new("sudo")
|
|
|
|
|
.arg("pacdiff")
|
|
|
|
|
.arg("-f")
|
|
|
|
|
.output()
|
|
|
|
|
.unwrap();
|
|
|
|
|
let find_lines = std::str::from_utf8(&find.stdout).unwrap().split("\n");
|
|
|
|
|
for line in find_lines {
|
|
|
|
|
if line.len() > 0 {
|
|
|
|
|
pacnew.push(line.to_string());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|