Show pacsave/pacnew files in summary (fix #70)

This commit is contained in:
Roey Darwish Dror
2018-10-02 11:36:10 +03:00
parent 15cec667b0
commit 3875f973d1
4 changed files with 58 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ use super::utils::{which, Check};
use failure;
use std::fs;
use std::path::PathBuf;
use walkdir::WalkDir;
#[derive(Copy, Clone, Debug)]
pub enum Distribution {
@@ -67,6 +68,32 @@ impl Distribution {
Some(("System update", success.is_ok()))
}
pub fn show_summary(self) {
if let Distribution::Arch = self {
show_pacnew();
}
}
}
pub fn show_pacnew() {
let mut iter = WalkDir::new("/etc")
.into_iter()
.filter_map(|e| e.ok())
.filter(|f| {
f.path()
.extension()
.filter(|ext| ext == &"pacnew" || ext == &"pacsave")
.is_some()
}).peekable();
if iter.peek().is_some() {
println!("\nPacman backup configuration files found:");
for entry in iter {
println!("{}", entry.path().display());
}
}
}
fn upgrade_arch_linux(sudo: &Option<PathBuf>, terminal: &mut Terminal, dry_run: bool) -> Result<(), failure::Error> {