mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 11:42:02 +08:00
feat: 支持在线升级功能
This commit is contained in:
@@ -87,8 +87,7 @@ impl ImageManager {
|
||||
.ok()
|
||||
.and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
|
||||
.map(|d| {
|
||||
chrono::DateTime::from_timestamp(d.as_secs() as i64, 0)
|
||||
.unwrap_or_else(Utc::now)
|
||||
chrono::DateTime::from_timestamp(d.as_secs() as i64, 0).unwrap_or_else(Utc::now)
|
||||
})
|
||||
.unwrap_or_else(Utc::now);
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ use crate::events::{EventBus, SystemEvent};
|
||||
use crate::utils::LogThrottler;
|
||||
|
||||
/// MSD health status
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Clone, PartialEq, Default)]
|
||||
pub enum MsdHealthStatus {
|
||||
/// Device is healthy and operational
|
||||
#[default]
|
||||
@@ -30,7 +29,6 @@ pub enum MsdHealthStatus {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
/// MSD health monitor configuration
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MsdMonitorConfig {
|
||||
|
||||
@@ -18,7 +18,6 @@ pub enum MsdMode {
|
||||
Drive,
|
||||
}
|
||||
|
||||
|
||||
/// Image file metadata
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ImageInfo {
|
||||
|
||||
@@ -328,9 +328,7 @@ impl VentoyDrive {
|
||||
let image = match VentoyImage::open(&path) {
|
||||
Ok(img) => img,
|
||||
Err(e) => {
|
||||
let _ = rt.block_on(tx.send(Err(std::io::Error::other(
|
||||
e.to_string(),
|
||||
))));
|
||||
let _ = rt.block_on(tx.send(Err(std::io::Error::other(e.to_string()))));
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -340,9 +338,7 @@ impl VentoyDrive {
|
||||
|
||||
// Stream the file through the writer
|
||||
if let Err(e) = image.read_file_to_writer(&file_path_owned, &mut chunk_writer) {
|
||||
let _ = rt.block_on(tx.send(Err(std::io::Error::other(
|
||||
e.to_string(),
|
||||
))));
|
||||
let _ = rt.block_on(tx.send(Err(std::io::Error::other(e.to_string()))));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -545,12 +541,10 @@ mod tests {
|
||||
.output()?;
|
||||
|
||||
if !output.status.success() {
|
||||
return Err(std::io::Error::other(
|
||||
format!(
|
||||
"xz decompress failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
),
|
||||
));
|
||||
return Err(std::io::Error::other(format!(
|
||||
"xz decompress failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
)));
|
||||
}
|
||||
|
||||
std::fs::write(dst, &output.stdout)?;
|
||||
|
||||
Reference in New Issue
Block a user