Move pacnew to the correct location
This commit is contained in:
@@ -6,6 +6,7 @@ use std::env::var_os;
|
|||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
fn get_execution_path() -> OsString {
|
fn get_execution_path() -> OsString {
|
||||||
let mut path = OsString::from("/usr/bin:");
|
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();
|
let package_manager = get_arch_package_manager(ctx).unwrap();
|
||||||
package_manager.upgrade(ctx)
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use log::debug;
|
|||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use walkdir::WalkDir;
|
|
||||||
|
|
||||||
static OS_RELEASE_PATH: &str = "/etc/os-release";
|
static OS_RELEASE_PATH: &str = "/etc/os-release";
|
||||||
|
|
||||||
@@ -110,7 +109,7 @@ impl Distribution {
|
|||||||
|
|
||||||
pub fn show_summary(self) {
|
pub fn show_summary(self) {
|
||||||
if let Distribution::Arch = self {
|
if let Distribution::Arch = self {
|
||||||
show_pacnew();
|
archlinux::show_pacnew();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,27 +124,6 @@ fn is_wsl() -> Result<bool> {
|
|||||||
Ok(output.contains("microsoft"))
|
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<()> {
|
fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let apk = require("apk")?;
|
let apk = require("apk")?;
|
||||||
let sudo = ctx.sudo().as_ref().unwrap();
|
let sudo = ctx.sudo().as_ref().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user