From 45d96b98c596f0065e462ec31a51b061116f68cc Mon Sep 17 00:00:00 2001 From: weishu Date: Tue, 11 Jul 2023 21:28:56 +0800 Subject: [PATCH] ksud: remove update flag file before mount. if module installation is failed, the module.img will be reverted and the update flag file may exist --- userspace/ksud/src/module.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/userspace/ksud/src/module.rs b/userspace/ksud/src/module.rs index d0144385..d0677082 100644 --- a/userspace/ksud/src/module.rs +++ b/userspace/ksud/src/module.rs @@ -14,7 +14,7 @@ use log::{info, warn}; use std::{ collections::HashMap, env::var as env_var, - fs::{remove_dir_all, set_permissions, File, Permissions}, + fs::{remove_dir_all, set_permissions, File, Permissions, remove_file}, io::Cursor, path::{Path, PathBuf}, process::{Command, Stdio}, @@ -333,8 +333,10 @@ pub fn prune_modules() -> Result<()> { let dir = std::fs::read_dir(modules_dir)?; for entry in dir.flatten() { let path = entry.path(); - let remove = path.join(defs::REMOVE_FILE_NAME); - if !remove.exists() { + + remove_file(path.join(defs::UPDATE_FILE_NAME)).ok(); + + if !path.join(defs::REMOVE_FILE_NAME).exists() { continue; }