diff --git a/src/kernel.rs b/src/kernel.rs index bad40fb..5f88b2b 100644 --- a/src/kernel.rs +++ b/src/kernel.rs @@ -224,12 +224,11 @@ fn download_alpine_kernel(branch: &str, arch: &str, dest: &Path) -> Result<()> { // Extract vmlinuz-virt from the APK // APK files are gzip-compressed tar archives let temp_apk = dest.with_extension("apk"); - extract_kernel_from_apk(&temp_apk, dest)?; - - // Clean up the APK + // Remove the ~45MB APK whatever the extraction outcome — don't leave + // it behind in the cache directory on failure. + let result = extract_kernel_from_apk(&temp_apk, dest); std::fs::remove_file(&temp_apk).ok(); - - Ok(()) + result } async fn download_kernel_async(url: &str, dest: &Path) -> Result<()> { @@ -316,6 +315,7 @@ fn extract_kernel_from_apk(apk_path: &Path, dest: &Path) -> Result<()> { // Extract to destination entry.unpack(dest).context("Failed to extract kernel")?; veprintln!(" Extracted kernel to: {}", dest.display()); + return Ok(()); } }