From 05d2781b480a54a403c0dfcd1c843b972d458632 Mon Sep 17 00:00:00 2001 From: Andrew Schott Date: Mon, 24 Jun 2024 01:55:03 -0500 Subject: [PATCH] Added distrobox suppport. --- osupdater/osupdater | 1 + osupdater/src/main.rs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 120000 osupdater/osupdater diff --git a/osupdater/osupdater b/osupdater/osupdater new file mode 120000 index 0000000..e2e89de --- /dev/null +++ b/osupdater/osupdater @@ -0,0 +1 @@ +/home/andrew/Workspace/git_repos/osupdater/osupdater/target/release/osupdater \ No newline at end of file diff --git a/osupdater/src/main.rs b/osupdater/src/main.rs index 654c0a6..b3860fd 100644 --- a/osupdater/src/main.rs +++ b/osupdater/src/main.rs @@ -17,7 +17,7 @@ fn main() { print!("{esc}[2J{esc}[1;1H", esc = 27 as char); // Tell user that we are going to start the update procedure - cprintln!("osupdater : rust edition -- This tool will locate and run any package managers on your system.\n"); + cprintln!("osupdater : This tool will locate and run any package/container managers on your system.\n"); cprintln!("Looking for native package managers.\n"); let find_sudo = Command::new("which") .arg("sudo").stdout(Stdio::piped()).output().unwrap(); @@ -69,6 +69,11 @@ fn main() { let mut pip_review_bin = String::from_utf8(find_pip_review.stdout).unwrap(); trim_newline(&mut pip_review_bin); + let find_distrobox_upgrade = Command::new("which") + .arg("distrobox-upgrade").stdout(Stdio::piped()).output().unwrap(); + let mut distrobox_upgrade_bin = String::from_utf8(find_distrobox_upgrade.stdout).unwrap(); + trim_newline(&mut distrobox_upgrade_bin); + //apt let path = Path::new(&apt_bin); if path.exists(){ @@ -206,5 +211,17 @@ fn main() { .spawn().unwrap(); let _output = cmd.wait(); } + + //Distrobox + let path = Path::new(&distrobox_upgrade_bin); + if path.exists(){ + cprintln!("Updating Distrobox containers"); + let mut cmd = + Command::new(&distrobox_upgrade_bin) + .arg("--all") + .stdout(Stdio::inherit()).stderr(Stdio::inherit()) + .spawn().unwrap(); + let _output = cmd.wait(); + } } }