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

This commit is contained in:
weishu
2023-07-11 21:28:56 +08:00
parent b554c66b46
commit 45d96b98c5

View File

@@ -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;
}