Move pacnew to the correct location

This commit is contained in:
Roey Darwish Dror
2021-10-25 22:53:53 +03:00
parent 124d125c18
commit 897b3094d8
2 changed files with 23 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ use std::env::var_os;
use std::ffi::OsString;
use std::path::{Path, PathBuf};
use std::process::Command;
use walkdir::WalkDir;
fn get_execution_path() -> OsString {
let mut path = OsString::from("/usr/bin:");
@@ -171,3 +172,24 @@ pub fn upgrade_arch_linux(ctx: &ExecutionContext) -> Result<()> {
let package_manager = get_arch_package_manager(ctx).unwrap();
package_manager.upgrade(ctx)
}
pub fn show_pacnew() {
let mut iter = WalkDir::new("/etc")
.into_iter()
.filter_map(Result::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());
}
}
}