particle-os-cli/src/ops.rs
Gerald Pinder c832bcd1aa
fix: Rebase path not being generated properly (#8)
* fix: Rebase path not being generated properly

* consolidate logic into generate_full_image_name

* Fix nightly build
2024-01-22 17:48:14 -05:00

26 lines
680 B
Rust

use anyhow::{anyhow, Result};
use log::{debug, trace};
use std::{path::Path, process::Command};
pub const LOCAL_BUILD: &str = "/etc/blue-build";
pub const ARCHIVE_SUFFIX: &str = "tar.gz";
pub fn check_command_exists(command: &str) -> Result<()> {
trace!("check_command_exists({command})");
debug!("Checking if {command} exists");
trace!("which {command}");
if Command::new("which")
.arg(command)
.output()?
.status
.success()
{
debug!("Command {command} does exist");
Ok(())
} else {
Err(anyhow!(
"Command {command} doesn't exist and is required to build the image"
))
}
}