Skip to content

Commit

Permalink
adding code for target
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaMilosa committed Aug 13, 2024
1 parent fc5a7f0 commit 9edddf8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions rs/cli/src/commands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,19 @@ impl Upgrade {
return Ok(UpdateStatus::NewVersion(release.version.clone()));
}

let triple = match std::env::consts::OS {
"linux" => "x86_64-unknown-linux",
"macos" => "x86_64-apple-darwin",
let arch = match std::env::consts::ARCH {
s if s.eq("aarch64") || s.eq("x86_64") => s,
s => {
return Err(anyhow::anyhow!(
"Architecture {} is currently not supported for automatic upgrades. Try building the code from source",
s
))
}
};

let os = match std::env::consts::OS {
"linux" => "unknown-linux",
"macos" => "apple-darwin",
s => {
return Err(anyhow::anyhow!(
"{} is not currently not supported for automatic upgrades. Try building the code from source",
Expand All @@ -93,7 +103,8 @@ impl Upgrade {
info!("Binary not up to date. Updating to {}", release.version);
info!("Release: {:?}", release);

let asset = match release.asset_for(&format!("dre-{}", triple), None) {
// Will result in something like `dre-x86_64-unknown-linux`
let asset = match release.asset_for(&format!("dre-{}-{}", arch, os), None) {
Some(asset) => asset,
None => return Err(anyhow::anyhow!("No assets found for release")),
};
Expand Down

0 comments on commit 9edddf8

Please sign in to comment.