Skip to content

Commit

Permalink
Flash hardware ids to /media/internal/ (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidma authored and okiwi6 committed Sep 30, 2024
1 parent 778292d commit ded8d40
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub const HULA_DBUS_SERVICE: &str = "org.hulks.hula";
pub const HULA_SOCKET_PATH: &str = "/tmp/hula";
pub const OS_IS_NOT_LINUX: bool = !cfg!(target_os = "linux");
pub const OS_RELEASE_PATH: &str = "/etc/os-release";
pub const OS_VERSION: &str = "7.5.0";
pub const OS_VERSION: &str = "7.5.1";
pub const SDK_VERSION: &str = "7.5.0";

lazy_static! {
Expand Down
5 changes: 2 additions & 3 deletions crates/nao/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Nao {
command
}

fn rsync_with_nao(&self, mkpath: bool) -> Command {
pub fn rsync_with_nao(&self, mkpath: bool) -> Command {
let mut command = Command::new("rsync");
let ssh_flags = self.get_ssh_flags().join(" ");
command
Expand Down Expand Up @@ -376,8 +376,7 @@ impl Nao {
.wrap_err("failed to execute rsync command")?;

monitor_rsync_progress_with(rsync, progress_callback).await?;

self.reboot().await
Ok(())
}
}

Expand Down
17 changes: 14 additions & 3 deletions tools/pepsi/src/gammaray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use argument_parsers::NaoAddress;
use constants::OS_VERSION;
use nao::Nao;
use opn::verify_image;
use repository::get_image_path;
use repository::{get_image_path, Repository};

use crate::progress_indicator::ProgressIndicator;

Expand All @@ -24,7 +24,7 @@ pub struct Arguments {
naos: Vec<NaoAddress>,
}

pub async fn gammaray(arguments: Arguments) -> Result<()> {
pub async fn gammaray(arguments: Arguments, repository: &Repository) -> Result<()> {
let version = arguments.os_version.as_deref().unwrap_or(OS_VERSION);
let image_path = match arguments.image_path {
Some(image_path) => image_path,
Expand All @@ -34,6 +34,8 @@ pub async fn gammaray(arguments: Arguments) -> Result<()> {

verify_image(image_path).wrap_err("image verification failed")?;

let hardware_ids = &repository.parameters_root().join("hardware_ids.json");

ProgressIndicator::map_tasks(
arguments.naos,
"Uploading image ...",
Expand All @@ -43,7 +45,16 @@ pub async fn gammaray(arguments: Arguments) -> Result<()> {
progress_bar.set_message(format!("Uploading image: {}", msg))
})
.await
.wrap_err_with(|| format!("failed to flash image to {nao_address}"))
.wrap_err_with(|| format!("failed to flash image to {nao_address}"))?;
progress_bar.set_message("Uploading hardware ids...");
nao.rsync_with_nao(false)
.arg(hardware_ids.to_str().unwrap())
.arg(format!("{}:/media/internal/", nao.host))
.spawn()
.wrap_err("failed to upload hardware ids")?;
nao.reboot()
.await
.wrap_err_with(|| format!("failed to reboot {nao_address}"))
},
)
.await;
Expand Down
2 changes: 1 addition & 1 deletion tools/pepsi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn main() -> Result<()> {
Command::Completions(arguments) => completions(arguments, Arguments::command())
.await
.wrap_err("failed to execute completion command")?,
Command::Gammaray(arguments) => gammaray(arguments)
Command::Gammaray(arguments) => gammaray(arguments, &repository?)
.await
.wrap_err("failed to execute gammaray command")?,
Command::Hulk(arguments) => hulk(arguments)
Expand Down

0 comments on commit ded8d40

Please sign in to comment.