Skip to content

Commit

Permalink
Fix builds and runs on DragonFly BSD (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelittlemonkey authored Oct 8, 2023
1 parent 71efce3 commit 1f6baef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/steps/os/dragonfly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ use crate::command::CommandExt;
use crate::execution_context::ExecutionContext;
use crate::terminal::print_separator;
use crate::utils::{require_option, REQUIRE_SUDO};
use crate::Step;
use color_eyre::eyre::Result;
use std::process::Command;

pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
print_separator("DragonFly BSD Packages");
let mut cmd = ctx.execute(sudo);
let mut cmd = ctx.run_type().execute(sudo);
cmd.args(["/usr/local/sbin/pkg", "upgrade"]);
if ctx.config().yes(Step::System) {
cmd.arg("-y");
Expand All @@ -19,8 +20,13 @@ pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
pub fn audit_packages(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
println!();
Command::new(sudo)
#[allow(clippy::disallowed_methods)]
if !Command::new(sudo)
.args(["/usr/local/sbin/pkg", "audit", "-Fr"])
.status_checked()?;
.status()?
.success()
{
println!("The package audit was successful, but vulnerable packages still remain on the system");
}
Ok(())
}

0 comments on commit 1f6baef

Please sign in to comment.