mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
Drop module image if no module remaining (#2447)
Some checks are pending
Build Manager / build-lkm (push) Waiting to run
Build Manager / build-ksud (macos-latest, aarch64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (macos-latest, x86_64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-pc-windows-gnu) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-manager (push) Blocked by required conditions
Clippy check / clippy (push) Waiting to run
Rustfmt check / format (push) Waiting to run
Some checks are pending
Build Manager / build-lkm (push) Waiting to run
Build Manager / build-ksud (macos-latest, aarch64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (macos-latest, x86_64-apple-darwin) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, aarch64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-linux-android) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-pc-windows-gnu) (push) Blocked by required conditions
Build Manager / build-ksud (ubuntu-latest, x86_64-unknown-linux-musl) (push) Blocked by required conditions
Build Manager / build-manager (push) Blocked by required conditions
Clippy check / clippy (push) Waiting to run
Rustfmt check / format (push) Waiting to run
This fixes the issue that module image will always exist even if there is no module to be loaded. Sadly we need to boot twice because we can only know module status after image is mounted.
This commit is contained in:
parent
500ff9bcbc
commit
ce13d050ca
@ -279,6 +279,18 @@ pub fn prune_modules() -> Result<()> {
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
// collect remaining modules, if none, remove img
|
||||
let remaining_modules: Vec<_> = std::fs::read_dir(defs::MODULE_DIR)?
|
||||
.filter_map(|entry| entry.ok())
|
||||
.filter(|entry| entry.path().join("module.prop").exists())
|
||||
.collect();
|
||||
|
||||
if remaining_modules.is_empty() {
|
||||
info!("no remaining modules, deleting image files.");
|
||||
std::fs::remove_file(defs::MODULE_IMG).ok();
|
||||
std::fs::remove_file(defs::MODULE_UPDATE_IMG).ok();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user