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());
}
}
}

View File

@@ -10,7 +10,6 @@ use log::debug;
use serde::Deserialize;
use std::path::{Path, PathBuf};
use std::process::Command;
use walkdir::WalkDir;
static OS_RELEASE_PATH: &str = "/etc/os-release";
@@ -110,7 +109,7 @@ impl Distribution {
pub fn show_summary(self) {
if let Distribution::Arch = self {
show_pacnew();
archlinux::show_pacnew();
}
}
@@ -125,27 +124,6 @@ fn is_wsl() -> Result<bool> {
Ok(output.contains("microsoft"))
}
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());
}
}
}
fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> {
let apk = require("apk")?;
let sudo = ctx.sudo().as_ref().unwrap();