From d1a9d0d8a8746a63b93f8f14ee4f51b1cd240349 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 29 Sep 2024 15:26:46 +0200 Subject: dnf install --- src/packages/dnf.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/packages') diff --git a/src/packages/dnf.rs b/src/packages/dnf.rs index aad9c8f..6f451ee 100644 --- a/src/packages/dnf.rs +++ b/src/packages/dnf.rs @@ -1,4 +1,4 @@ -use std::process::Command; +use std::process::{Command, Stdio}; use super::{Package, PackageList, PackageManager}; @@ -46,5 +46,17 @@ impl PackageManager for Dnf { }) } - fn install(&self, _pkgs: Vec) -> Result<()> { todo!() } + fn install(&self, pkgs: Vec) -> Result<()> { + let mut args = vec!["dnf".to_string(), "install".to_string(), "--assumeyes".to_string()]; + + for pkg in pkgs { + args.push(pkg.id); + } + Command::new("sudo") + .stdout(Stdio::inherit()) + .args(args) + .spawn()? + .wait_with_output()?; + Ok(()) + } } -- cgit v1.2.3