fix: 修复 MSD 启用时 Ventoy 资源初始化问题 #275

- 将 Ventoy 资源初始化纳入 MSD 控制器启用流程
- 支持运行时启用 MSD,无需重启服务
- 调整验收测试并移除启用后的重启逻辑
This commit is contained in:
mofeng-git
2026-07-19 20:08:03 +08:00
parent d31e70515a
commit 5d871e8b21
5 changed files with 24 additions and 48 deletions

View File

@@ -335,24 +335,8 @@ async fn main() -> anyhow::Result<()> {
#[cfg(unix)]
let msd = if config.msd.enabled {
let ventoy_resource_dir = data_dir.join("ventoy");
if ventoy_resource_dir.exists() {
if let Err(e) = ventoy_img::init_resources(&ventoy_resource_dir) {
tracing::warn!("Failed to initialize Ventoy resources: {}", e);
} else {
tracing::info!(
"Ventoy resources initialized from {}",
ventoy_resource_dir.display()
);
}
} else {
tracing::warn!(
"Ventoy resource directory not found: {}",
ventoy_resource_dir.display()
);
}
let controller = MsdController::new(otg_service.clone(), config.msd.msd_dir_path());
if let Err(e) = controller.init().await {
if let Err(e) = controller.init(&ventoy_resource_dir).await {
tracing::warn!("Failed to initialize MSD controller: {}", e);
None
} else {