Added distrobox suppport.

This commit is contained in:
Andrew Schott 2024-06-24 01:55:03 -05:00
parent 49f6b0fc36
commit 05d2781b48
2 changed files with 19 additions and 1 deletions

1
osupdater/osupdater Symbolic link
View file

@ -0,0 +1 @@
/home/andrew/Workspace/git_repos/osupdater/osupdater/target/release/osupdater

View file

@ -17,7 +17,7 @@ fn main() {
print!("{esc}[2J{esc}[1;1H", esc = 27 as char); print!("{esc}[2J{esc}[1;1H", esc = 27 as char);
// Tell user that we are going to start the update procedure // Tell user that we are going to start the update procedure
cprintln!("<bold><rev>osupdater : rust edition -- This tool will locate and run any package managers on your system.</rev></bold>\n"); cprintln!("<bold><rev>osupdater : This tool will locate and run any package/container managers on your system.</rev></bold>\n");
cprintln!("<bold><rev>Looking for native package managers.</rev></bold>\n"); cprintln!("<bold><rev>Looking for native package managers.</rev></bold>\n");
let find_sudo = Command::new("which") let find_sudo = Command::new("which")
.arg("sudo").stdout(Stdio::piped()).output().unwrap(); .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(); let mut pip_review_bin = String::from_utf8(find_pip_review.stdout).unwrap();
trim_newline(&mut pip_review_bin); 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 //apt
let path = Path::new(&apt_bin); let path = Path::new(&apt_bin);
if path.exists(){ if path.exists(){
@ -206,5 +211,17 @@ fn main() {
.spawn().unwrap(); .spawn().unwrap();
let _output = cmd.wait(); let _output = cmd.wait();
} }
//Distrobox
let path = Path::new(&distrobox_upgrade_bin);
if path.exists(){
cprintln!("<bold><rev>Updating Distrobox containers</rev></bold>");
let mut cmd =
Command::new(&distrobox_upgrade_bin)
.arg("--all")
.stdout(Stdio::inherit()).stderr(Stdio::inherit())
.spawn().unwrap();
let _output = cmd.wait();
}
} }
} }