fix: return Ok after extracting kernel from APK
extract_kernel_from_apk fell through to an unconditional error after a successful extraction, so every first --kernel run failed after downloading the 45MB package; the second run worked from cache. Also remove the downloaded APK even when extraction fails.
This commit is contained in:
+5
-5
@@ -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(());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user