2018-08-26 16:12:59 +03:00
|
|
|
use super::executor::Executor;
|
2018-12-05 11:34:08 +02:00
|
|
|
use super::terminal::{print_separator, print_warning};
|
2018-06-17 14:17:36 +03:00
|
|
|
use super::utils::{which, Check};
|
2018-06-07 16:19:11 +03:00
|
|
|
use failure;
|
2018-11-18 14:25:16 +02:00
|
|
|
use failure_derive::Fail;
|
2018-06-07 16:19:11 +03:00
|
|
|
use std::fs;
|
2018-06-12 21:28:32 +03:00
|
|
|
use std::path::PathBuf;
|
2018-10-02 11:36:10 +03:00
|
|
|
use walkdir::WalkDir;
|
2018-06-07 16:19:11 +03:00
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
|
pub enum Distribution {
|
|
|
|
|
Arch,
|
|
|
|
|
CentOS,
|
|
|
|
|
Fedora,
|
|
|
|
|
Debian,
|
|
|
|
|
Ubuntu,
|
2018-10-21 15:08:36 +03:00
|
|
|
Gentoo,
|
2018-11-03 22:57:09 +02:00
|
|
|
OpenSuse,
|
2018-11-20 14:38:23 +02:00
|
|
|
Void,
|
2018-06-07 16:19:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Fail)]
|
|
|
|
|
#[fail(display = "Unknown Linux Distribution")]
|
|
|
|
|
struct UnknownLinuxDistribution;
|
|
|
|
|
|
2018-06-12 21:35:04 +03:00
|
|
|
#[derive(Debug, Fail)]
|
|
|
|
|
#[fail(display = "Detected Python is not the system Python")]
|
|
|
|
|
struct NotSystemPython;
|
|
|
|
|
|
2018-06-07 16:19:11 +03:00
|
|
|
impl Distribution {
|
|
|
|
|
pub fn detect() -> Result<Self, failure::Error> {
|
|
|
|
|
let content = fs::read_to_string("/etc/os-release")?;
|
|
|
|
|
|
2018-07-11 07:35:30 +03:00
|
|
|
if content.contains("Arch") | content.contains("Manjaro") | content.contains("Antergos") {
|
2018-06-07 16:19:11 +03:00
|
|
|
return Ok(Distribution::Arch);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-07 10:22:13 +02:00
|
|
|
if content.contains("CentOS") || content.contains("Oracle Linux") {
|
2018-06-07 16:19:11 +03:00
|
|
|
return Ok(Distribution::CentOS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if content.contains("Fedora") {
|
|
|
|
|
return Ok(Distribution::Fedora);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if content.contains("Ubuntu") {
|
|
|
|
|
return Ok(Distribution::Ubuntu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if content.contains("Debian") {
|
|
|
|
|
return Ok(Distribution::Debian);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-03 22:57:09 +02:00
|
|
|
if content.contains("openSUSE") {
|
|
|
|
|
return Ok(Distribution::OpenSuse);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-20 14:38:23 +02:00
|
|
|
if content.contains("void") {
|
|
|
|
|
return Ok(Distribution::Void);
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-21 15:08:36 +03:00
|
|
|
if PathBuf::from("/etc/gentoo-release").exists() {
|
|
|
|
|
return Ok(Distribution::Gentoo);
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-07 16:19:11 +03:00
|
|
|
Err(UnknownLinuxDistribution.into())
|
|
|
|
|
}
|
2018-10-02 10:46:38 +03:00
|
|
|
|
|
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn upgrade(self, sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static str, bool)> {
|
|
|
|
|
print_separator("System update");
|
2018-10-02 10:46:38 +03:00
|
|
|
|
|
|
|
|
let success = match self {
|
2018-12-05 11:34:08 +02:00
|
|
|
Distribution::Arch => upgrade_arch_linux(&sudo, dry_run),
|
|
|
|
|
Distribution::CentOS => upgrade_redhat(&sudo, dry_run),
|
|
|
|
|
Distribution::Fedora => upgrade_fedora(&sudo, dry_run),
|
|
|
|
|
Distribution::Ubuntu | Distribution::Debian => upgrade_debian(&sudo, dry_run),
|
|
|
|
|
Distribution::Gentoo => upgrade_gentoo(&sudo, dry_run),
|
|
|
|
|
Distribution::OpenSuse => upgrade_opensuse(&sudo, dry_run),
|
|
|
|
|
Distribution::Void => upgrade_void(&sudo, dry_run),
|
2018-10-02 10:46:38 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Some(("System update", success.is_ok()))
|
|
|
|
|
}
|
2018-10-02 11:36:10 +03:00
|
|
|
|
|
|
|
|
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()
|
2018-12-11 16:00:19 +02:00
|
|
|
})
|
|
|
|
|
.peekable();
|
2018-10-02 11:36:10 +03:00
|
|
|
|
|
|
|
|
if iter.peek().is_some() {
|
|
|
|
|
println!("\nPacman backup configuration files found:");
|
|
|
|
|
|
|
|
|
|
for entry in iter {
|
|
|
|
|
println!("{}", entry.path().display());
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-07 16:19:11 +03:00
|
|
|
}
|
2018-06-12 21:28:32 +03:00
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_arch_linux(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-06-17 14:17:36 +03:00
|
|
|
if let Some(yay) = which("yay") {
|
|
|
|
|
if let Some(python) = which("python") {
|
2018-06-12 21:35:04 +03:00
|
|
|
if python != PathBuf::from("/usr/bin/python") {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning(format!(
|
2018-06-12 21:35:04 +03:00
|
|
|
"Python detected at {:?}, which is probably not the system Python.
|
|
|
|
|
It's dangerous to run yay since Python based AUR packages will be installed in the wrong location",
|
|
|
|
|
python
|
|
|
|
|
));
|
|
|
|
|
return Err(NotSystemPython.into());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(yay, dry_run).spawn()?.wait()?.check()?;
|
2018-07-10 07:29:41 +03:00
|
|
|
} else if let Some(sudo) = &sudo {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
2018-07-10 07:29:41 +03:00
|
|
|
.args(&["/usr/bin/pacman", "-Syu"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
2018-06-12 21:28:32 +03:00
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo or yay detected. Skipping system upgrade");
|
2018-06-12 21:28:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_redhat(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-06-12 21:28:32 +03:00
|
|
|
if let Some(sudo) = &sudo {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
2018-07-01 20:24:01 +03:00
|
|
|
.args(&["/usr/bin/yum", "upgrade"])
|
2018-06-12 21:28:32 +03:00
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo detected. Skipping system upgrade");
|
2018-11-03 22:57:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_opensuse(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-11-03 22:57:09 +02:00
|
|
|
if let Some(sudo) = &sudo {
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.args(&["/usr/bin/zypper", "refresh"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.args(&["/usr/bin/zypper", "dist-upgrade"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo detected. Skipping system upgrade");
|
2018-11-20 14:38:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_void(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-11-20 14:38:23 +02:00
|
|
|
if let Some(sudo) = &sudo {
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.args(&["/usr/bin/xbps-install", "-Su"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo detected. Skipping system upgrade");
|
2018-06-12 21:28:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_fedora(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-06-12 21:28:32 +03:00
|
|
|
if let Some(sudo) = &sudo {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
2018-07-01 20:24:01 +03:00
|
|
|
.args(&["/usr/bin/dnf", "upgrade"])
|
2018-06-12 21:28:32 +03:00
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo detected. Skipping system upgrade");
|
2018-06-12 21:28:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_gentoo(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-10-21 15:08:36 +03:00
|
|
|
if let Some(sudo) = &sudo {
|
|
|
|
|
if let Some(layman) = which("layman") {
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.arg(layman)
|
|
|
|
|
.args(&["-s", "ALL"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
println!("Syncing portage");
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.arg("/usr/bin/emerge")
|
|
|
|
|
.args(&["-q", "--sync"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
|
|
|
|
|
if let Some(eix_update) = which("eix-update") {
|
|
|
|
|
Executor::new(&sudo, dry_run).arg(eix_update).spawn()?.wait()?.check()?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.arg("/usr/bin/emerge")
|
|
|
|
|
.args(&["-uDNa", "world"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo detected. Skipping system upgrade");
|
2018-10-21 15:08:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 11:34:08 +02:00
|
|
|
fn upgrade_debian(sudo: &Option<PathBuf>, dry_run: bool) -> Result<(), failure::Error> {
|
2018-06-12 21:28:32 +03:00
|
|
|
if let Some(sudo) = &sudo {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
2018-07-01 20:24:01 +03:00
|
|
|
.args(&["/usr/bin/apt", "update"])
|
2018-06-12 21:28:32 +03:00
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
2018-07-01 20:24:01 +03:00
|
|
|
.args(&["/usr/bin/apt", "dist-upgrade"])
|
2018-06-12 21:28:32 +03:00
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
} else {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_warning("No sudo detected. Skipping system upgrade");
|
2018-06-12 21:28:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
2018-06-28 12:16:54 +03:00
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn run_needrestart(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static str, bool)> {
|
2018-08-19 14:45:23 +03:00
|
|
|
if let Some(sudo) = sudo {
|
|
|
|
|
if let Some(needrestart) = which("needrestart") {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_separator("Check for needed restarts");
|
2018-06-28 12:16:54 +03:00
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
let success = || -> Result<(), failure::Error> {
|
2018-09-14 13:47:32 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.arg(needrestart)
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
2018-06-28 12:16:54 +03:00
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
Ok(())
|
2018-12-11 16:00:19 +02:00
|
|
|
}()
|
|
|
|
|
.is_ok();
|
2018-08-19 14:45:23 +03:00
|
|
|
|
|
|
|
|
return Some(("Restarts", success));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
2018-06-28 12:16:54 +03:00
|
|
|
}
|
|
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn run_fwupdmgr(dry_run: bool) -> Option<(&'static str, bool)> {
|
2018-08-19 14:45:23 +03:00
|
|
|
if let Some(fwupdmgr) = which("fwupdmgr") {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_separator("Firmware upgrades");
|
2018-06-28 12:16:54 +03:00
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
let success = || -> Result<(), failure::Error> {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&fwupdmgr, dry_run)
|
|
|
|
|
.arg("refresh")
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
Executor::new(&fwupdmgr, dry_run)
|
|
|
|
|
.arg("get-updates")
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
2018-08-19 14:45:23 +03:00
|
|
|
Ok(())
|
2018-12-11 16:00:19 +02:00
|
|
|
}()
|
|
|
|
|
.is_ok();
|
2018-08-19 14:45:23 +03:00
|
|
|
|
|
|
|
|
return Some(("Firmware upgrade", success));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
2018-06-28 12:16:54 +03:00
|
|
|
}
|
|
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn flatpak_user_update(dry_run: bool) -> Option<(&'static str, bool)> {
|
2018-08-19 14:45:23 +03:00
|
|
|
if let Some(flatpak) = which("flatpak") {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_separator("Flatpak User Packages");
|
2018-06-28 12:16:54 +03:00
|
|
|
|
2018-08-19 14:45:23 +03:00
|
|
|
let success = || -> Result<(), failure::Error> {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&flatpak, dry_run)
|
2018-10-02 14:30:10 +03:00
|
|
|
.args(&["update", "--user", "-y"])
|
2018-08-26 16:12:59 +03:00
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
2018-08-19 14:45:23 +03:00
|
|
|
Ok(())
|
2018-12-11 16:00:19 +02:00
|
|
|
}()
|
|
|
|
|
.is_ok();
|
2018-08-19 14:45:23 +03:00
|
|
|
|
2018-10-02 14:30:10 +03:00
|
|
|
return Some(("Flatpak User Packages", success));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn flatpak_global_update(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static str, bool)> {
|
2018-10-02 14:30:10 +03:00
|
|
|
if let Some(sudo) = sudo {
|
|
|
|
|
if let Some(flatpak) = which("flatpak") {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_separator("Flatpak Global Packages");
|
2018-10-02 14:30:10 +03:00
|
|
|
|
|
|
|
|
let success = || -> Result<(), failure::Error> {
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.args(&[flatpak.to_str().unwrap(), "update", "-y"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
Ok(())
|
2018-12-11 16:00:19 +02:00
|
|
|
}()
|
|
|
|
|
.is_ok();
|
2018-10-02 14:30:10 +03:00
|
|
|
|
|
|
|
|
return Some(("Flatpak Global Packages", success));
|
|
|
|
|
}
|
2018-08-19 14:45:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn run_snap(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static str, bool)> {
|
2018-08-19 14:45:23 +03:00
|
|
|
if let Some(sudo) = sudo {
|
|
|
|
|
if let Some(snap) = which("snap") {
|
2018-08-26 13:47:36 +03:00
|
|
|
if PathBuf::from("/var/snapd.socket").exists() {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_separator("snap");
|
2018-08-19 14:45:23 +03:00
|
|
|
|
2018-08-26 13:47:36 +03:00
|
|
|
let success = || -> Result<(), failure::Error> {
|
2018-08-26 16:12:59 +03:00
|
|
|
Executor::new(&sudo, dry_run)
|
2018-08-26 13:47:36 +03:00
|
|
|
.args(&[snap.to_str().unwrap(), "refresh"])
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
2018-08-19 14:45:23 +03:00
|
|
|
|
2018-08-26 13:47:36 +03:00
|
|
|
Ok(())
|
2018-12-11 16:00:19 +02:00
|
|
|
}()
|
|
|
|
|
.is_ok();
|
2018-08-19 14:45:23 +03:00
|
|
|
|
2018-08-26 13:47:36 +03:00
|
|
|
return Some(("snap", success));
|
|
|
|
|
}
|
2018-08-19 14:45:23 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
2018-06-28 12:16:54 +03:00
|
|
|
}
|
2018-10-02 13:25:02 +03:00
|
|
|
|
|
|
|
|
#[must_use]
|
2018-12-05 11:34:08 +02:00
|
|
|
pub fn run_etc_update(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static str, bool)> {
|
2018-10-02 13:25:02 +03:00
|
|
|
if let Some(sudo) = sudo {
|
|
|
|
|
if let Some(etc_update) = which("etc-update") {
|
2018-12-05 11:34:08 +02:00
|
|
|
print_separator("etc-update");
|
2018-10-02 13:25:02 +03:00
|
|
|
|
|
|
|
|
let success = || -> Result<(), failure::Error> {
|
|
|
|
|
Executor::new(&sudo, dry_run)
|
|
|
|
|
.arg(&etc_update.to_str().unwrap())
|
|
|
|
|
.spawn()?
|
|
|
|
|
.wait()?
|
|
|
|
|
.check()?;
|
|
|
|
|
|
|
|
|
|
Ok(())
|
2018-12-11 16:00:19 +02:00
|
|
|
}()
|
|
|
|
|
.is_ok();
|
2018-10-02 13:25:02 +03:00
|
|
|
|
2018-10-21 15:16:14 +03:00
|
|
|
return Some(("etc-update", success));
|
2018-10-02 13:25:02 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
|
|
|
|
}
|