[Add] Iota updater now with it's own crate
This commit is contained in:
parent
17929bdad3
commit
eff1c019a8
6 changed files with 40 additions and 26 deletions
|
|
@ -1,2 +1,3 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["iota-storage", "iota-terms", "iota-state", "iota-cli", "iota-core", "omikron-connector", "web-server", "web-ui", "iota-logger", "iota-util"]
|
members = ["iota-storage", "iota-updater", "iota-terms", "iota-state", "iota-cli", "iota-core", "omikron-connector", "web-server", "web-ui", "iota-logger", "iota-util"]
|
||||||
|
resolver = "3"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
[package]
|
||||||
|
name = "iota-updater"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
iota-logger = { path = "../iota-logger" }
|
||||||
|
|
||||||
|
ttp-core = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-core" }
|
||||||
|
ttp-native = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-native" }
|
||||||
|
|
||||||
|
json = "*"
|
||||||
|
pnet = "0.35.0"
|
||||||
|
ratatui = "0.30.0"
|
||||||
|
reqwest = "0.13.2"
|
||||||
|
tokio = { version = "1.50.0", features = ["full"] }
|
||||||
|
sysinfo = "0.38.3"
|
||||||
|
uuid = { version = "*", features = ["v4"] }
|
||||||
|
walkdir = "2.5.0"
|
||||||
|
zip = "6.0.0"
|
||||||
|
aes-gcm = "0.10.3"
|
||||||
|
base64 = "0.22.1"
|
||||||
|
rand_core = { version = "0.6", features = ["getrandom", "std"] }
|
||||||
|
sha2 = "0.10.9"
|
||||||
|
x448 = { version = "*" }
|
||||||
|
hkdf = "0.12.4"
|
||||||
|
once_cell = "1.21.3"
|
||||||
|
hex = "*"
|
||||||
|
serde = "1.0.228"
|
||||||
|
tempfile = "3.27.0"
|
||||||
|
anyhow = "1.0.102"
|
||||||
|
semver = "1.0.28"
|
||||||
|
self-replace = "1.5.0"
|
||||||
|
|
@ -4,9 +4,10 @@
|
||||||
* It is made by Yolokit and pasted in by AlexEmmet */
|
* It is made by Yolokit and pasted in by AlexEmmet */
|
||||||
|
|
||||||
use anyhow::{Context, Result, anyhow};
|
use anyhow::{Context, Result, anyhow};
|
||||||
|
use iota_logger::log;
|
||||||
|
use self_replace::self_replace;
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::copy;
|
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
@ -98,7 +99,7 @@ async fn asset_name_for_current_platform() -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn download_asset(url: &str) -> Result<NamedTempFile> {
|
async fn download_asset(url: &str) -> Result<NamedTempFile> {
|
||||||
let mut response = reqwest::get(url)
|
let response = reqwest::get(url)
|
||||||
.await
|
.await
|
||||||
.context("failed to download asset")?;
|
.context("failed to download asset")?;
|
||||||
|
|
||||||
|
|
@ -148,8 +149,7 @@ async fn perform_update() -> Result<bool> {
|
||||||
|
|
||||||
let downloaded = download_asset(&asset.browser_download_url).await?;
|
let downloaded = download_asset(&asset.browser_download_url).await?;
|
||||||
|
|
||||||
self_replace::self_replace(downloaded.path())
|
self_replace(downloaded.path()).context("failed to replace current executable")?;
|
||||||
.context("failed to replace current executable")?;
|
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,9 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
ttp-core = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-core" }
|
ttp-core = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-core" }
|
||||||
ttp-native = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-native" }
|
ttp-native = { git = "https://git.methanium.net/Tensamin/TTP.git", package = "ttp-native" }
|
||||||
|
|
||||||
json = "*"
|
|
||||||
pnet = "0.35.0"
|
|
||||||
ratatui = "0.30.0"
|
|
||||||
reqwest = "0.13.2"
|
reqwest = "0.13.2"
|
||||||
tokio = { version = "1.50.0", features = ["full"] }
|
tokio = { version = "1.50.0", features = ["full"] }
|
||||||
sysinfo = "0.38.3"
|
sysinfo = "0.38.3"
|
||||||
|
|
@ -23,10 +19,4 @@ rand_core = { version = "0.6", features = ["getrandom", "std"] }
|
||||||
sha2 = "0.10.9"
|
sha2 = "0.10.9"
|
||||||
x448 = { version = "*" }
|
x448 = { version = "*" }
|
||||||
hkdf = "0.12.4"
|
hkdf = "0.12.4"
|
||||||
once_cell = "1.21.3"
|
|
||||||
hex = "*"
|
hex = "*"
|
||||||
serde = "1.0.228"
|
|
||||||
tempfile = "3.27.0"
|
|
||||||
anyhow = "1.0.102"
|
|
||||||
semver = "1.0.28"
|
|
||||||
serde_macros = "0.8.9"
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
pub mod crypto_helper;
|
pub mod crypto_helper;
|
||||||
pub mod crypto_util;
|
pub mod crypto_util;
|
||||||
pub mod file_util;
|
pub mod file_util;
|
||||||
pub mod langu;
|
|
||||||
pub mod update_util;
|
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,7 @@ futures = "*"
|
||||||
futures-util = "*"
|
futures-util = "*"
|
||||||
hex = "*"
|
hex = "*"
|
||||||
hkdf = "0.12.4"
|
hkdf = "0.12.4"
|
||||||
hyper = { version = "1.8.1", features = [
|
hyper = { version = "1.8.1", features = ["capi", "client", "full", "http1", "http2", "nightly", "server"] }
|
||||||
"capi",
|
|
||||||
"client",
|
|
||||||
"full",
|
|
||||||
"http1",
|
|
||||||
"http2",
|
|
||||||
"nightly",
|
|
||||||
"server",
|
|
||||||
] }
|
|
||||||
hyper-util = { version = "*" }
|
hyper-util = { version = "*" }
|
||||||
json = "*"
|
json = "*"
|
||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue